Restarting workflow not working properly

Shivam Saxena1
Mega Expert

Hello,

 

I am facing very weird issue while restarting the workflow.

I am restarting the workflow when the change state moves to Draft by clicking on Re-Draft button. So using UI Action I am just setting the values like change state, clearing start/end date etc. and for starting the workflow I am using after business rule. Please refer below screenshots.

 

find_real_file.png

 

find_real_file.png

 

I am writing the business rule in scoped application that's why used global prefix.

 

I am getting below issues :

1. Sometimes workflow working fine after restarting.

2. Sometimes workflow getting stuck in begin after restarting.

3. Sometimes workflow gets completed with all activity as restarted but only set fields and end activity as finished then workflow will not start.

 

find_real_file.png

 

Please help me in identifying where I am going wrong?

 

Thanks.

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

I have restarted workflows in a simple Fix Script for a few RITMS, and we always add an update line after the restart so that the workflow doesn't get stuck.  It's similar to the Nudge button when viewing the workflow context.  I'm not sure if you can do this all in one line, so I'll show you the syntax that has worked for us.

var wflow = new global.Workflow();
wflow.restartWorkflow(current);
wflow.runFlows(current, "update"); //the update is just going to nudge the workflow

If something is still amiss sometimes, what does it look like if you Show Workflow from the RITM to see the active or completed context?  Are any activities blue/completed or green/running?

 

 

View solution in original post

8 REPLIES 8

Brad Bowman
Kilo Patron
Kilo Patron

I have restarted workflows in a simple Fix Script for a few RITMS, and we always add an update line after the restart so that the workflow doesn't get stuck.  It's similar to the Nudge button when viewing the workflow context.  I'm not sure if you can do this all in one line, so I'll show you the syntax that has worked for us.

var wflow = new global.Workflow();
wflow.restartWorkflow(current);
wflow.runFlows(current, "update"); //the update is just going to nudge the workflow

If something is still amiss sometimes, what does it look like if you Show Workflow from the RITM to see the active or completed context?  Are any activities blue/completed or green/running?

 

 

Hi Brad,

 

Thanks for your reply.

When I used your code, the workflow moved to finished state and change moved to scheduled but re-draft UI Action did its work and cleared the field values whatever we defined in UI Action.

 

find_real_file.png

 

Thanks.

Shivam Saxena1
Mega Expert

Workflow getting restarted now. It works perfectly fine now. But sometimes it is not getting restarted and gets completed when I am trying to Re-Draft it.

 

This context does seem to indicate that it did get restarted.  Did it go all the way to the end right away due to no open approvals?  It doesn't look like your business rule conditions or script cover approvals already approvd/completed (or skipped due to no/an invalid approver).  What activity was the workflow on just before it was re-started?  You might be able to determine more of what happened here from the Workflow Context link on the RITM, on the Workflow Activity History, or maybe Workflow Log...