locked
Refresh Form issue RRS feed

  • Question

  • Hi,

    I am trying to refresh the whole form after saving it. I am doing something like this.

    But it always creates a duplicate record after running this script. I am triggering this script on change of 'Modified On' field.

    How can I get rid of duplicates? Please guide me.

    function formRefresh()
    {
    debugger;
    Xrm.Page.data.save(true).then(
      function () {
            Xrm.Page.data.entity.attributes.forEach(function (attribute, index) {
                attribute.setSubmitMode("never");
            });
            Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
        },
        function (errorCode, message) {
        }
        );
    }
    Thanks for any help.



    • Edited by ReignFan Wednesday, August 26, 2015 1:32 PM
    Wednesday, August 26, 2015 1:32 PM

All replies

  • I would suggest instead use the Xrm.Page.data.refresh function (click the function to go to the page).


    Saturday, August 29, 2015 7:26 AM
  • Hi,

    You can get help from this code.

    modifiedon_onChange: function () { reloadFormAfterSave(); } reloadFormAfterSave: function () { setTimeout(function () { Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId()); }, 500); }

    for more information see the below link

    http://vinukumaran.com/Blog/post/2014/12/22/how-to-reload-crm-2013-form-after-save-of-a-record.aspx


    Saturday, August 29, 2015 9:08 AM