locked
Your changes have not been saved. To stay on the page so that you can save your changes, click Cancel RRS feed

  • Question

  • Below is my CRM 2013 code:

     var clone = Xrm.Page.getAttribute("new_clone");
        var cloneValue = clone.getValue();
        if (cloneValue != "clone" && cloneValue != "") {
            clone.setSubmitMode("always");
            clone.setValue("");
            Xrm.Page.data.entity.save();
            Xrm.Utility.openEntityForm("new_marketing_plan", cloneValue);
        }

    actually clone value was saved, but it always prompt this error msg:

    Your changes have not been saved. To stay on the page so that you can save your changes, click Cancel


    Awen

    Tuesday, October 21, 2014 1:21 PM

Answers

  • Hi can you try using this function:

    Xrm.Page.data.entity.save("saveandclose");

    Also refer this and this


    Regards, Saad


    • Edited by Mohd Saad Wednesday, October 22, 2014 6:40 AM
    • Marked as answer by Awen Hu Friday, October 24, 2014 4:07 AM
    Wednesday, October 22, 2014 6:37 AM

All replies

  • Hi,

    Please try save().then(successCallback,errorcallback);

    Xrm.Page.data.entity.save().then( successCallback(cloneValue), null);
    
    function successCallback(id)
    {
       Xrm.Utility.openEntityForm("new_marketing_plan", id)
    }

    Hope this will fix the issue




    • Edited by Siddique Mahsud Wednesday, October 22, 2014 6:03 AM
    • Proposed as answer by Johninfant Friday, October 24, 2014 4:06 AM
    Wednesday, October 22, 2014 5:51 AM
  • Hi,

    what happens when you set the setsubmitmode to never?

    Xrm.Page.getAttribute('new_clone').getSubmitMode("never");

    Thanks!

    Kalim Khan

    Wednesday, October 22, 2014 6:33 AM
  • Hi can you try using this function:

    Xrm.Page.data.entity.save("saveandclose");

    Also refer this and this


    Regards, Saad


    • Edited by Mohd Saad Wednesday, October 22, 2014 6:40 AM
    • Marked as answer by Awen Hu Friday, October 24, 2014 4:07 AM
    Wednesday, October 22, 2014 6:37 AM