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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Refresh page after workflow

(1) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Lucas Dantas,

    You cannot run JavaScript from a workflow.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    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.

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    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
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    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
    Pawar Pravin  Profile Picture
    5,237 on at

    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
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

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

    Hope this helps.

  • Community Member Profile Picture
    on at

    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?

  • Community Member Profile Picture
    on at

    They are already a real-time workflow

  • Community Member Profile Picture
    on at

    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.

  • Shalabh Gupta Profile Picture
    91 on at

    Hi Ravi,

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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans