- 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 09:46 AM
Hello
refer my last answer, it will do the cameo for you.
if you need any more assistance in finishing this task, please provide me some details.
Please Provide me some details of below questions:-
1) are your tasks are in parallel, depends on some condition(simultaneously 2 tasks are assigned to groups) or task are generating one by one i.e.(in sequence, means after close complete or incomplete of task new task is getting trigger)
2) Do you want to set RITM and REQ State after each catalog Task
Please Provide me these details, so that I can help you out in this case.
if need more assistance we can connect on email
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat