web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Save and Reload form or full Refresh

(1) ShareShare
ReportReport
Posted on by 390

Hi,

I am having problem in CRM form save and refresh.

Once I save the form using javascript command Xrm.Page.data.entity.save(), the page is not refreshed. I need to full refresh the form. Because after saving all fields will be disabled, but that is not happening unless I manually reload the form again after save.

I used the Xrm.Utility.openEntityForm() command to reload after save command, but this time I am getting a popup "Your changes are not saved. are you navigate from this page". This is because the Xrm.Utility.openEntityForm() is executed even before the save operation is completed. looks the save is asynchronous.

Questions:

1. Why CRM does not reload the form automatically on save

2. How to do synchronous save using javascript command

3. Why Xrm.Page.data.entity.save().then(success, failure) is not working.

4. What is the solution to save the form, and then reload the form again.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Sounds like you may have scripts or something causing so-called "dirty fields" on save.

    Try this in the browser console and see what fields you may get:

    frames[0].Xrm.Page.data.entity.getDataXml();

  • Community Member Profile Picture
    on at

    Hi,

    After calling save method on form as you are calling Xrm.Page.data.entity.save();

    You need to call the Refresh Method as well it refresh the saved form and changes are done.

    Xrm.Page.data.entity.refresh();

  • arif imteyaz Profile Picture
    375 on at

    when form readonly then data will not save from Xrm.Page.data.entity.save()

  • Nuno Profile Picture
    2,005 on at

    Hi,

    Don´t you have any other javascript function working onSave event which changes some fields values?

  • arif imteyaz Profile Picture
    375 on at

    you can call js on change event.

  • Jayakumar Profile Picture
    390 on at

    Hi Erik,

    Dirty fields are modified fields. So it should be saved along with the save command right?

  • Jayakumar Profile Picture
    390 on at

    Hi Muhammad,

    I tried the refresh command also. The fields will be read-only after I save. But after refresh command the fields are still editable. After reloading the page the fields are marked read-only.

  • Jayakumar Profile Picture
    390 on at

    Hi Arif,

    The form is editable initially. After some field value is set to particular value and save, then all fields will be set to read-only. But after save the field is still editable. I have to reload the form to make the fields disabled.

  • Community Member Profile Picture
    on at

    Hi Jayakumar,

    it seems form Refresh issue has resolve by using Refresh() method

    Now your are facing the problems to disabled the controls you should use the following script to disabled the control Xrm.Page.getControl("fieldname").setDisabled(true);

    Try to call following script onload of form this:

    if(Xrm.Page.ui.getFormType()==2) //check for update

    Xrm.Page.getControl("fieldname").setDisabled(true);

    Thanks

  • Suggested answer
    Community Member Profile Picture
    on at

    How about this:

    function Form_onsave() {
         . . .


        // REFRESH to display the newly exposed fields' data.
        // community.dynamics.com/.../173659
        if (Xrm.Page.data.entity.getIsDirty()) {
            Xrm.Page.data.save().then(function () {    // The save prevents "unsaved"-warning.
                Xrm.Page.data.refresh();
            }, null);
        }

        // Refresh the Annotation List
        . . .
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans