When any one task is getting cancelled need to cancel rest all task and need to cancel the ritm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2022 04:51 AM
Can anyone please help me how to achieve this.
I am creating 4tasks at a time when the request is getting submitted. Tasks are getting created from flow designer. If any one of the task is getting closed complete or closed skipped rest all task need to set as closed skipped or closed incomplete and ritm should get update as closed incomplete. Not able to do in flow designer.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2022 10:20 AM
Hi pritimayee,
create after Business rule on sc_task table
after giving conditions use below script on advanced tab
(function executeRule(current, previous /*null when async*/) {
var sct = new GlideRecord('sc_task');
// to find active records
sct.addActiveQuery();
//records for the same parent
sct.addQuery("requested_item", current.requested_item);
//exclude current task record
sct.addQuery("sys_id", "!=", current.sys_id);
sct.query();
while(sct.next()){
sct.state = 7;
sct.update();
}
//close the request item
var ritmGr= new GlideRecord("sc_req_item");
ritmGr.get(current.getValue('requested_item'));
if(ritmGr){
ritmGr.state = 7; //Closed skipped
ritmGr.update();
}
})(current, previous);
Hope it helps!!
Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar