Reopen a Request and its linked items (RITM and SCTASK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 03:55 PM
Hi,
Is it possible to reopen a Request and restart the workflow? Also, reopen the RITM and the SCTASK associated?
I have read a lot post but I didn't really find what I need. I have the requirement of having reopen request in case it was closed by error or because there was something missing from the work done.
I want to have a Reopen Request button in the Request, and it should be appear only when the Request has been Closed Complete, so when the Fulfiller hit that button, it should reopen the RITM and the SCTASK, and restart the workflow.
The workflow is simple, nothing complex, and we always have 1 RITM associated to each request, and the SCTASK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 03:46 AM
This UI Action on the sc_request table will only show if the REQ is Closed Complete, and will change the State of the REQ and its RITM to 'Open'. It will also restart the workflow on the RITM, which in turn will reopen any/all Catalog Tasks as it comes to that step.
//reopen REQ
current.state = 1;
//reopen RITM
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', current.sys_id);
ritm.addQuery('state', 'IN', 3,4,7);
ritm.query();
if (ritm.next()) {
ritm.state = 1;
ritm.update();
current.update();
action.setRedirectURL(current);
gs.addInfoMessage('REQ and RITM ' + ritm.number + ' reopened.');
//restart workflow on RITM
var wflow = new Workflow();
wflow.restartWorkflow(ritm);
wflow.runFlows(ritm, "update"); // the update is just going to nudge the workflow
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 06:55 PM
Hello Brad,
I'm not able to see the picture you attached, can you add it as attachment or include it your comment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2022 06:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2022 05:24 PM
Hello Brad,
Thanks for your reply. It seems that it opens the RITM and SCTASK, but not the REQ. I'm getting this message when I open the SCTASK number. It seems that it cannot be re-opened. I have the same code you sent me.
I just included one more condition, but I don't think that is the issue.
current.state==3 && current.u_rd==true