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 01:48 AM
Hey latha,
Refer the thread:
Mark correct and helpful if you find response Worthy!!
Best Regards,
Namrata.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 01:51 AM
Hi Latha,
I'm guessing that when you close the RITM there is only a single sctask linked. On closing this sctask via the BR it is then moving to the next activity in the workflow which is then creating the second sctask. In your BR you need to also cancel the workflow. You can refer to this article around how to script this.
I hope this helps, if so please mark as helpful or correct
Thanks
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 02:00 AM
Hi,
I assume this BR is on sc_req_item table
the above code should work fine
Is some task getting created when RITM is closed?
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
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
06-18-2020 02:23 AM
HI Ankur,
In RITM i want to show 2 tasks closed complete..
if i use new Workflow().cancel(current); only 1 catalog task complete and stop workflow..
but i want to show 2 catalog tasks completed in ritm(through wf)
Thanks...