Ritm should close as closed incomplete if any of the two sctasks are closed as incomplete. Also the ritm should wait till all teh sctasks are closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 08:20 PM
Hi Team,
We have a requirement where 2-3 sctasks are attached for a ritm and it should close only after all the sctasks are closed. Also if any of the sctasks are closed as closed incomplete, the ritm should be closed as closed incomplete. Otherwise it should closed as closed complete.
Can you please help us in achieving this. Thanks in advance.
Regards,
Padmaja.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 08:48 PM
Hi,
so what have you started with?
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
‎03-29-2022 09:27 PM
Hi Ankur,
Thanks for quick reply.
We have created workflow of each Catalog Item that it applies to by adding the Closed Complete, Closed Incomplete conditions to each Catalog Task activity. After that we have join item which waits till both the tasks are closed complete/imcomplete.
after that we are wondering where/how to write logic for the below senerios and set the state of RITM accordingly.
sctask1, sctask2 both closed as complete=>RITM state is closed complete
Any of the ctask1, sctask2 is closed incomplete=> RITM state should be closed incomplete.
Regards,
Padmaja.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 09:35 PM
Hi,
you can use run script activity after both the tasks are done and check if both are closed complete or closed incomplete
var completeCount = 0;
var incompleteCount = 0;
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.getUniqueValue());
gr.query();
var totalCount = gr.getRowCount();
while (gr.next()) {
if(gr.state == 3)
completeCount++;
if(gr.state == 34)
incompleteCount++;
}
if(totalCount == completeCount)
current.state = 3;
if(totalCount == incompleteCount)
current.state = 4;
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
‎03-29-2022 10:11 PM