locked
Save and New on quoteline item RRS feed

  • Question

  • Hi All,

    We are using MS CRM 2016.

    I have enabled Save and New button of quotelineitem entity by customizing the display rule and changed its default commands with the below code to copy the quoteid parent data to new record when save and new is clicked, It worked for the first time as expected but from the new record if we again fill the data and try to click save and new it does not work. it even does not get saved or nothing happens and screen is stuck.

    Is there a way to resolve this.

    function SaveAndNew() {
        Xrm.Page.data.save().then(OpenNewForm, function () { });
    }

    function OpenNewForm() {
        var parameters = {};

        if (Xrm.Page.getAttribute("quoteid").getValue() != null) {
            parameters.quoteid = Xrm.Page.getAttribute("quoteid").getValue()[0].id;
            parameters.quoteidname = Xrm.Page.getAttribute("quoteid").getValue()[0].name;
            parameters.quoteidtype = Xrm.Page.getAttribute("quoteid").getValue()[0].typename;
        }

        Xrm.Utility.openEntityForm("quotedetail", null, parameters);
    }

    Regards,

    Rekha J


    Regards, Rekha J

    Tuesday, July 11, 2017 1:10 PM

All replies

  • Hello,

    Try to remove line

    parameters.quoteidtype = Xrm.Page.getAttribute("quoteid").getValue()[0].typename;

    It should work without it. "type" field is needed for polymorphic fields only (like customer or regarding).

    Also typename should return undefined because there is entityType, no typename.

    Good luck.


    Dynamics CRM/Business Solutions MVP
    Read My blog

    Tuesday, July 11, 2017 2:24 PM
    Moderator
  • Hi Andrii,

    I actually tried even without typename but still no luck, it does not work for the second time.

    Regards,

    Rekha J


    Regards, Rekha J

    Wednesday, July 12, 2017 5:58 AM