workflow is stuck at begin after restart of its workflow

dhruva
Kilo Contributor

Workflow is stuck at begin after restart of its workflow.

find_real_file.png

Here when "flag to yes " activity is reached i am restarting it via BR

BR is as follows:

createtask();

function createtask() {

  gs.addInfoMessage("restarting workflow");

  current.u_response = '';

new Workflow().restartWorkflow(current);

}

what might be the issue here ??why is it gettin gstuck at begin even though when validated shows no signs of warnings/errors

1 ACCEPTED SOLUTION

arron_ubhi
ServiceNow Employee
ServiceNow Employee

Hi Dhruva,



Have you attempted to do an update to the source record where the workflow is running?



The workflow does not seem to continue as although the workflow has restarted, there is no update to the record in order for the workflow to progress.



Once you update the source record, e.g. Change Request, Requested Item, etc, then the workflow should proceed as expected.



You will need to modify the logic to allow the source record to be updated, so that the workflow can move forward



Please note: I would NOT recommend using any "current.update()" script in the business rule to force the workflow to move forward as this will cause a performance impact


Reference: Business Rules Best Practices - ServiceNow Wiki



Please let me know if you have any further questions.




Best Regards,



Arron


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Hi Dhruva,



Try moving the message and restartWorkflow() to an after business rule. You want to impact related records after the changes have been saved to the database.



your current.u_response = ''; is in the right place (if this is in fact a BEFORE business rule.)



Business Rules Best Practices - ServiceNow Wiki


Hi ctomasi


Thanks for your response,find_real_file.png


dhruva
Kilo Contributor

if you can see in image it is a already an after business rule , even then it is stuck, any solution for this ?


arron_ubhi
ServiceNow Employee
ServiceNow Employee

Hi Dhruva,



Have you attempted to do an update to the source record where the workflow is running?



The workflow does not seem to continue as although the workflow has restarted, there is no update to the record in order for the workflow to progress.



Once you update the source record, e.g. Change Request, Requested Item, etc, then the workflow should proceed as expected.



You will need to modify the logic to allow the source record to be updated, so that the workflow can move forward



Please note: I would NOT recommend using any "current.update()" script in the business rule to force the workflow to move forward as this will cause a performance impact


Reference: Business Rules Best Practices - ServiceNow Wiki



Please let me know if you have any further questions.




Best Regards,



Arron