The CreatorCon Call for Content is officially open! Get started here.

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

 

9 REPLIES 9

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

@mathewirene 

Hope you are doing good.

Did my reply answer your question?

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 

Hope you are doing good.

Did my reply answer your question?

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