Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Refresh page after workflow

Posted on by Microsoft Employee

Hello,

I have been trying to make a refresh function after the execution of a workflow, but I am not able to achieve this.

If I create a javascript based on a field change, it only works if someone is executing the action manually. However if this manual intervention is replaced by a workflow, the java script does not get triggered. That tells me I should probably invoke the javascript from the workflow, but I am not sure how to achieve this.

Example: I have a record type that I have enabled status transition and this record goes from Initial > Intermediate > Final. I have a workflow #1 that moves the record from Initial to Intermediate and another workflow #2 that moves the record from Intermediate to Final. In this case scenario, I have to execute the first workflow and manually refresh the page to see the that the status has changed.

Our goal is when we execute the workflow the page gets refreshed, just like it happens when we activate/deactivate a record. It automatically refresh the forms and it is visible that some modification has been made.

*This post is locked for comments

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Refresh page after workflow

    Hi,

    No the page will not reload but it will refresh the data.

  • Shalabh Gupta Profile Picture
    Shalabh Gupta 91 on at
    RE: Refresh page after workflow

    Hi Ravi,

    Would converting this back to a RTW reload the form back?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Refresh page after workflow

    These functions are only triggered if the user manually change the fields. If the change is made through a workflow, you can't see the changes unless you refresh the page.

    I want to execute a workflow and then if it is successful, it should refresh my current page, regardless if it is a view or a form.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Refresh page after workflow

    They are already a real-time workflow

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Refresh page after workflow

    As of now users will use a button I have created in the ribbon to execute WF1 & WF2. But this is just one of the examples we have.

    But we also have workflows to unlock/lock a record making it a read-only record or not.

    Would you help me achieving this by sharing a sample code?

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Refresh page after workflow

    Hi,

    Try changing your workflow from background to real time if possible.

    Hope this helps.

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: Refresh page after workflow

    Hi Lucas,

    Unfortunately there is no any supported way to call js using workflow. There is one workaround that you can call js on after certain millisecond of time.

    For this requirement you need to use setTimeout() function on onload of form.

    Regards,

    Pravin

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    Temmy Wahyu Raharjo 2,914 on at
    RE: Refresh page after workflow

    For this requirement, if the workflow is direct logic (means that u will update attribute without stating wait), then you need to change it into plugin.

    After plugin fire, it will automatically will trigger internal function to change value on the form. So usually I will put function on modifiedon event onchange to refresh the page.

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: Refresh page after workflow

    Workflow also needs a trigger point, it can be an update/status change, eventually some user interaction directly on record form or somewhere else like in grid ribbon. But this is on server side whereas JS will trigger only on form events - based on user action.

    So users will run WF1 & WF2 manually with an interval? Can you give 2 ribbon buttons to move the status from initial to intermediate in a ribbon button 1 & final status update in ribbon button 2. You can achieve this in js itself & you can refresh the form.

    No need of WFs as the server side code cannot trigger client side code.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Refresh page after workflow

    Hi,

    As said you can't do that using workflow but, as a work around you can have js attached to your form which can use setinterval and check value of he field updated from the workflow after specified time interval and if field value exists refresh page.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans