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)

Refresh form when status changes

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Community Member Profile Picture
    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 - MVP Profile Picture
    30,190 Moderator 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
    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
    50,091 Moderator 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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans