- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2021 05:57 PM
Looking for some assistance figuring out why this workflow is not closing the RITM and the REQ after the SCTASKs have been completed. I've tried several workflow variations, but I can't get it figured out. There up to 4 separate tasks that are created depending on the selections made on the catalog item. There could 1, 2, 3, or 4 tasks created. I need all opened tasks to be completed before the RITM and REQ close. Currently, closing all tasks still leaves the RITM and REQ open.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2021 08:55 AM
Hello
After Your Join Query Please add a Run Script Core Activity. and Add this script into that Run Script. also connect that set values activity which is at left side to this run script.
so after your set values(attached to join) and set values coming from left side, attach both these set values to this run script before end activity.
Please make some change if required as per requirement. but this is working code from my project.
var req= current.request.getRefRecord();
var gr= new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.addQuery('state','3');//get the list of all closed tasks
gr.query();
if(gr.getRowCount()>0){ //at least one closed task found
current.state='4'; //set the RITM state to closed
current.stage='complete';
req.stage = 'closed_complete';
req.state='3';
}else{
current.state='5';
current.stage='Request Cancelled';
req.stage = 'closed_incomplete';
req.state='3';
}
//current.update();
req.update();
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2021 11:26 AM
Thank you, Gaurav. The script and your instructions worked exactly as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2021 01:22 AM
Hello
I am Glad, your issue has been resolved.
are you going to send email notification also after close, complete of Request/RITM?
do u need any help on that? if yes, please create new question thread and redirect me in it using
You can also visit some of my Community Articles and mark helpful
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2021 04:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2021 04:56 PM
It is only working if there are 4 SCTASKs to begin with, but there are not always 4 SCTASKs. There can be 1, 2, 3 or 4 SCTASKs depending on the selections made on the Catalog Item by the requestor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2021 11:27 AM