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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Force Refresh after Form Save

(0) ShareShare
ReportReport
Posted on by 110

Hello,

I am trying to force refreshing a form after saving it to display the results of the workflow on the form. But I always get a javascript error. I tried to run the following line on the form properties with no success:


Xrm.Page.data.refresh(save).then(successCallback, errorCallback);



I have MS Dynamics CRM 2016 (On-Premise). How can I resolve this?. Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rajkumar Rajaraman Profile Picture
    on at
    RE: Force Refresh after Form Save

    Use this:

    // Save the current record to prevent messages about unsaved changes

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

    setTimeout(function () {

       // Call the Open Entity Form method and pass through the current entity name and ID to force CRM to reload the record

       Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());

    }, 3000);

  • Ashraf Abu-Abdou Profile Picture
    110 on at
    RE: Force Refresh after Form Save

    Thanks for your reply. It did not work. I got the same javascript "undefined" error

  • Gopalan Bhuvanesh Profile Picture
    11,401 on at
    RE: Force Refresh after Form Save

    Hi

    Would you please copy the full error message.

  • Ashraf Abu-Abdou Profile Picture
    110 on at
    RE: Force Refresh after Form Save

    "There was an error with this fields customized event, Field:crmForm, Event:onsave, Error:Out of stack space"

  • Suggested answer
    ashlega Profile Picture
    34,477 on at
    RE: Force Refresh after Form Save

    You are passing "save" parameter to the refresh - is it "true" or "false"? 

    It seems that onsave runs into a recursion there, somehow, so, maybe, if you used "false" for that parameter, it would not anymore..

    Actually, I'm wondering why would you need it at all - is not the form gets refreshed automatically after save? Is that workflow you are referring to a "real time" workflow?

  • Ashraf Abu-Abdou Profile Picture
    110 on at
    RE: Force Refresh after Form Save

    Yes it is a real-time workflow. The problem remains. I could not see the intended results of the workflow - especially for the SLA - until I do manual refresh

  • ashlega Profile Picture
    34,477 on at
    RE: Force Refresh after Form Save

    Are you still getting a javascript error or are you not seeing the results?

  • Ashraf Abu-Abdou Profile Picture
    110 on at
    RE: Force Refresh after Form Save

    If I use the javascript code provided on this thread, I get error. If I use no code, I get no error but results of the workflow won't show until I manually refresh. I need it to refresh automatically after saving the form

  • ashlega Profile Picture
    34,477 on at
    RE: Force Refresh after Form Save

    I just tried it in both 365 and 2015 (no 2016 here):

    - Account entity

    - A real time workflow that updates "title" field and which is triggered by an update of the description field

    On the existing account, "title" field gets updated (and I see the change right away) as soon as I update the description field. I don't have to use "refresh" for that.

    There are, really, two questions:

    - Do you want to fix the script?

    - Or do you want to fix the CRM behavior?

    For the first one, I'm wondering if you did try to pass "false" to the refresh.

    For the second one, we need more details with screenshots: how is the workflow configured, what are the triggers, how does it look like on the form..

  • Ashraf Abu-Abdou Profile Picture
    110 on at
    RE: Force Refresh after Form Save

    I have SLA's that are triggered after certain fields are selected and the form is saved. For example, if "Customer Services" team approved a case then saved the form, first response flag would become "Successful". But that does not happen unless I manually refresh the page. My only problem is with refreshing the page and nothing else. All my workflows are "real-time"

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
UllrSki Profile Picture

UllrSki 2

#1
Community Member Profile Picture

Community Member 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans