How to restart a workflow on field change?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 12:40 AM
Hi,
I'm trying to restart the change request's workflow on a field change with advanced business rule.
The workflow first activity changes to grey (restarted) and start running again but it is not asking for approvals again (the rest of the workflow stays the same, I checked the workflow history so I know it is restarting),
the script:
(function executeRule(current, previous /*null when async*/){
var chng = new GlideRecord('chnage_request');
chng.addQuery('number', current.number);
chng.query();
if(chng.next()){
var workflow = new global.Workflow();
workflow.cancel(chng);
workflow.restartWorkflow(chng);
}
})(current, previous);
Anyone have any ideas? Thanks! 🙂
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 12:58 AM
Hello Snow Tomcal,
Could you please check once with below script:
(function executeRule(current, previous /*null when async*/){
var chng = new GlideRecord('change_request');
chng.addQuery('number', current.number);
chng.query();
if(chng.next()){
var workflow = new global.Workflow();
workflow.cancel(chng);
workflow.restartWorkflow(chng, false);
}
})(current, previous);
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:14 AM
It is still restarting the workflow without asking for the approvals again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:13 AM
Hello,
(function executeRule(current, previous /*null when async*/){
var chng = new GlideRecord('change_request');
chng.addQuery('number', current.number);
chng.query();
if(chng.next()){
var workflow = new global.Workflow();
workflow.cancel(chng);
workflow.restartWorkflow(chng, false);
}
})(current, previous);
Refer below blog for more:-
https://servicenowguru.com/scripting/business-rules-scripting/reset-change-request-workflow-approvals-tasks/
Regards,
Vaishnavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:17 AM
Hi, it is restarting the workflow but only the first core activity changes the color to grey.
The approvals are cancelled but not restarted (it is not possible to approve again).