- 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 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 02:07 PM
Hello Chuck,
I am able to run the workflow now . I tried to restart the requested Item workflow the same way but it is not running.
Is there a way i can achieve this.
Thank You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 05:35 AM
Have you tried running this script in Scripts - Background to see if there is any output worth noting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 03:31 PM
Hi Chuck,
Sorry for the delay in response. I was able to restart the requested itemas well by setting the stage to waiting for approval. The cascade workflow business rule on the request is checking if the RITM stage is waiting for approval.
Thank You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2017 10:08 AM
Check out the inactive business rule named: SNC Approval - Reset conditions
the rule contains details about how to reset the workflow, and a section on what is the reset conditions.
I've used this and it works great!