close multiple catalog tasks when ritm is closed..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 01:43 AM
HI,
I want to set state as closed complete for all catalog tasks when ritm state is closed complete..This is happens for only 1 catalog item only..
Here i wrote brule on requested item
after ,update
when to run:state changes to closed complete and Item is .....
var reqItem= new GlideRecord('sc_task');
reqItem.addQuery('request_item',current.sys_id);
reqItem.query();
while(reqItem.next()){
reqItem.setValue('state',3);
reqItem.update();
}
Here when i close ritm state only 1 catalog task is closed, after closing 1st task 2nd is opened but not closed it is in open state....how to achieve?
Thanks in advance...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 03:10 AM
Hi,
what it means only 2 tasks closed complete
How many tasks are created for this RITM?
if 3 then you want only 2 tasks to closed?
could you be more clear and precise.
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
‎06-18-2020 03:25 AM
hi,
In workflow i used 2 tasks so i want to close 2 only...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 03:39 AM
Hi,
So this script should close tasks belonging to the RITM
Is it closing any other unwanted tasks?
please check how many tasks for current RITM?
var reqItem= new GlideRecord('sc_task');
reqItem.addQuery('request_item',current.sys_id);
reqItem.query();
while(reqItem.next()){
reqItem.setValue('state',3);
reqItem.update();
}
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
‎05-19-2021 12:21 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
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
‎01-26-2022 02:54 PM
Hi Ankur,
I created a BR on sc_req_item table and the above code has helped me.
When I close RITM all the attached CAtalog Tasks are closed as well.
Thanks for your help.
Manthan