Parent RITM should get closed as soon as the Child RITM's are created

Ankita9793
Tera Contributor

Hi All

 

My requirement is when a catalog is submitted, multiple child RITM's to be created but the Parent RITM should get closed as soon as the Child RITM's are created. How can i achieve it?

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Ankita9793 

Are you using the order guide?

 

https://www.servicenow.com/community/developer-forum/how-to-close-request-if-all-request-items-are-c...

 

https://www.servicenow.com/community/itsm-forum/close-request-when-ritm-is-closed/td-p/2748440

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG 

No, Catalog Item 
I scenario is different from the reference link you have mentioned. 
In my case, when catalog item is submitted, Child RITM's will get created which will be linked to parent. 
As soon as child ritm's get created, parent RITM should be marked as closed.

Hi @Ankita9793 

The links are just for reference — you can build your own logic based on the examples shown above.

In your case, it's RITM, so the tables and logic will need to be adjusted accordingly, mate.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@Ankita9793 

how is the linkage between parent and child? is it via parent field on sc_req_item table?

If yes then you can use after insert BR on sc_req_item table

Note: give your child catalog item names here

Condition: current.cat_item.name == 'Your Child Item Name 1' || current.cat_item.name == 'Your Child Item Name 2' || current.cat_item.name == 'Your Child Item Name 3'

Script:

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

	// Add your code here
	var parentRitmRec = current.parent.getRefRecord();
	parentRitmRec.state = 3;
	parentRitmRec.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