- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:03 PM
Hi All,
How can I close the RITM when all the catalog task are changes to closed using business rule
Thanks
Surbhi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2022 10:35 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:10 PM
Hi Surbhi,
You can use this code to close The RITM when all sc_tasks are closed:-
var grCatTask = new GlideRecord('sc_task');
grCatTask.addQuery('request_item', current.sys_id);
grCatTask.query();
while(grCatTask.next()){
if(grCatTask.state != 3){
gr.query();
if(!gr.next()){
var gritem=new GlideRecord('sc_req_item');
gritem.addQuery('sys_id',current.request_item);
gritem.query();
if(gritem.next()){
gritem.state='3';
}
gritem.update();
}
answer = false;
}
}
Thank you,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:27 PM
Thanks Kunal!!
But its not working
Regards
surbhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:11 PM
Hi,
You have to write after update business rule on sc_task table. where you have to check the RITM and its other catalog tasks are closed or not.
IF all are closed then mark the RITM as closed.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:19 PM
Thanks Sagar!!
But I want Script
Thanks