Resetting Approvals in Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2010 08:15 AM
Hi All,
Hoping somebody can provide some input into something we are trying to configure. Within change management there are a number of mandatory fields. If somebody modifies any of these fields the workflow should start again.
Therefore, how do we start the workflow again? Will the existing workflow need to be finished and another one started? How would this be set within the workflow? Would this be controlled using a business rule?
Hoping somebody can assist with the requirement above.
Thanks
T.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2010 08:23 AM
This article explains a couple of ways that you can handle this.
http://www.servicenowguru.com/scripting/business-rules-scripting/reset-change-request-workflow-approvals-tasks/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 07:08 PM
Hi Mark,
your article is very useful.
I am trying to run a scheduled script (every x hours) that check the planned start date. If it is due, it will reset approvals (if any) and workflow. Also, will change state to new.
I modified your script but the reset bit does not work. It does add work_notes and change the state ONLY.
var comment = 'Approval reset by system. RFC not approved before the start date'; //written to the approval_history
var gr = new GlideRecord('change_request');
gr.addEncodedQuery("active=True^stateIN-4^type=Normal");
gr.query();
while(gr.next()) {
if (gr.start_date <= gs.daysAgo(0)) {
// Delete all of the existing approvals for the change and restart the workflow to create new approvals
new WorkflowApprovalUtils().cancelAll(current.sys_id);
new Workflow().restartWorkflow(current.sys_id);
//Use this section to reset any necessary information on the Change request
gr.work_notes = 'Change approvals and workflow reset due to RFC not being approved';
gr.approval = 'not requested';
gr.state = -5;
//Use this section to reset any necessary information on any associated Change tasks
//var tsk = new GlideRecord('change_task');
//tsk.addQuery('change_request', current.sys_id);
//tsk.query();
//while(tsk.next()){
//tsk.work_notes = 'Change request workflow reset.';
//tsk.update();
//}
}
gr.update();
}
any sort of help will be appreciate it.
max