- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 10:05 AM
How to reopen cancelled Request.
I am changing request state and stage and setting the workflow to true using the below script:
var gr= new GlideRecord('sc_request')
gr.addQuery('sys_id', 'sample sys_id');
gr.query();
while(gr.next()) {
gr.request_state="pending";
gr.setWorkflow(true);
gr.update();
}
But the workflow is not setting back. Is there a way to run the workflow again.
Thank You
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 01:24 PM
Rather than gr.sys_id, it expects the GlideRecord object.
var gr= new GlideRecord('sc_request')
gr.addQuery('sys_id', 'sample sys_id');
gr.query();
while(gr.next()) {
gr.request_state="pending";
new WorkflowApprovalUtils().cancelAll(gr, "comment");
new Workflow().restartWorkflow(gr, true);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 11:29 AM
HI rev,
// The following options are available for resetting the approvals:
//
// 1. Mark all existing approvals for the change as 'cancelled' and
restart the workflow to create new approvals
// new WorkflowApprovalUtils().cancelAll(current, comment);
// new Workflow().restartWorkflow(current);
//
// 2. Delete all of the existing approvals for the change and restart
the workflow to create new approvals
new WorkflowApprovalUtils().reset(current, comment);
gs.addInfoMessage('Workflow has been reset since key fields have been
modified');
//
// 3. Leave the approvals for the change in their current state and
restart the workflow.
// (so that any new approvals that are required will be created)
// if (comment)
// current.setDisplayValue('approval_history', comment);
// new Workflow().restartWorkflow(current, true);
//
}
}