Update RITM state when all its related child task is Closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 09:19 AM
Hi All,
Thanks for looking into my query,
I was looking to create a BR to update RITMs state when all its related child task is update to closed complete state.
I am using the Below script on BR which is created to Run on Update on the SCTASK table and State of catalog task changes to closed complete as a condition.
Please help if there is some issue on the above script; Please note we need to create this script only to update 25 RITM, which has the issues for flow context not getting captured.
Any Suggestions on the same will be highly appreciable.
Thanks
Kaustubh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 09:43 AM
Hi @Kaustubh k ,
Create a Business rule.
Try below code:
// If you have more than one RITM for REQ then Use this Code.
var getRITM = new GlideRecord('sc_req_item');
getRITM.addActiveQuery();
getRITM.addQuery('request',current.request);
getRITM.query();
if(getRITM.next())
{
//DO whatever you want to do here;
//Dont close REQ as One of the RITM Is open.
gs.addInfoMessage('REQ cant be closed because one of the RITM is Open');
}
else
{
var req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next())
{
req.req_state = 'closed_complete';
req.update();
}
}
Please Mark Correct, Helpful or Like.
Thanks & Regards,
Sumanth Meda