Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Refresh form when status changes

Posted on by Microsoft Employee

I would like to invoke some sort of custom action, plugin, script or workflow to refresh a form whenever the statuscode field changes.

We have buttons in the ribbon that perform a few changes in our records, including change of status (statuscode). As of now we need to refresh the form to see the changes, at the beginning this was not a big deal, but now users are starting to complain about it.

I would like to know if there is anything out there I could use to refresh the form, but it needs to be triggered after the workflow has been successfully finished.

Any help is appreciated.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Refresh form when status changes

    I have tried your code but it does not trigger when a workflow changes the record.

    If I manually update a field, the script loads, but when I just use my buttons in top ribbon, nothing happens and I need to refresh the form to see the changes.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Refresh form when status changes

    Hi Lucas,

    There is no need to invoke Server Side Code (Plugin/Action) to refresh a form. Those processes execute on the server side and cannot cause a page to refresh.

    In order to refresh a page you need to use a client side process, basically using JavaScript.

    The best approach as Goutam specified is using the Xrm.Utility.openEntityForm and passing the entity name and the entity id for that process. You can also use window.location.reload(true); to refresh the page from server side, which I have seen to work most of the times, but had some issues with it in the past.

    I have used the following to reload an existing form (my feeling best approach):

    function reloadPage()

    {

      var recordId = Xrm.Page.data.entity.getId();

      var entityName = Xrm.Page.data.entity.getEntityName();

      Xrm.Utility.openEntityForm(entityName, recordId);

    }

    Hope this helps.

  • Shidin Haridas Profile Picture
    Shidin Haridas 3,497 on at
    RE: Refresh form when status changes

    Use the code that Goutam suggested on change of the 'modifiedon' field.

    This would ensure that a new window is opened once the record save has gone through :)

    But consider doing a fields only refresh instead of loading the entire form, for the obvious performance concerns.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Refresh form when status changes

    Hi Lucas ,

    I pretty much sure you know about that  -

    msdn.microsoft.com/.../jj602956.aspx

    var EntityId =Xrm.Page.data.entity.getId();

    var EntityName = Xrm.Page.data.entity.getEntityName();

    Xrm.Utility.openEntityForm( EntityName ,EntityId );

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans