RITM not closed despite cancelled SCTASK

mathewirene
Tera Contributor

Hello,

There is a incident raised stating that the RITM was raised for a hardware category . That catalog item had a workflow of creating two SCTASKS. Here the issue one SCTASK got closed complete and later which created another sctask which was also closed skipped state. Even when both the SCTASKS are closed the RITM still is in open state. Hence user wants  to know why RITM is still active . How and where can i check this. How to troubleshoot this. Which all parameters should i check on this to investigate.

 

Thanks

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@mathewirene 

in your workflow for your catalog item are you closing RITM?

If not then this should happen for all RITMs for that catalog item.

you can write your custom business rule on sc_task and it will close RITM once last SC Task is closed

you can use after update BR on sc_task

Condition: State [IS ONE OF] Closed Complete/Closed Incomplete/Closed Skipped AND Request Item.Item == Your Catalog Item

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord('sc_task');
	gr.addQuery('request_item', current.request_item); 
	gr.addQuery('active', true);
	gr.query();
	if(!gr.next()){
		var ritm = current.request_item.getRefRecord(); 
		ritm.state = 3;
		ritm.update();
	}

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@mathewirene 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Viraj Hudlikar
Tera Sage

Hello @mathewirene 

 

The RITM is still open because its workflow or flow has not reached an end state. The closure of SCTASKS only triggers the next step in the workflow, but doesn't necessarily close the RITM. The most common reason for this is that the workflow or flow is either stuck, waiting for another condition, or simply doesn't have an activity to explicitly close the RITM.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

@mathewirene

 

Thank you for marking my response as helpful! 😊

I hope your concern has been fully addressed. If it resolves your issue, please consider marking it as the accepted solution. This will ensure others in the community can benefit from the solution too.

As per new community feature you can mark multiple responses as correct.


Thanks & Regards
Viraj Hudlikar.