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.

padmaja9
Tera Contributor

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.

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so what have you started with?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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. 

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

Can you please suggest me where to write the run script and how to connect the complete incomplete nodes of catalog tasks?

attaching the snapshot of sample workflow.

 

Regards,

Padmaja