When parent incident gets closed, its associated child incidents should also get closed.

Parth_S
Tera Contributor

Which BR should i use for this case ?

After or Async ?

Is it possible by using both BR's ?

 

6 REPLIES 6

Runjay Patel
Giga Sage

Hi @Parth_S ,

 

You can write before BR and use below script.

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

	// Add your code here
var childIncidents = new GlideRecord('incident');
    childIncidents.addQuery('parent_incident', current.sys_id); 
    childIncidents.addQuery('active', true); 
    childIncidents.query();

    while (childIncidents.next()) {
       
        childIncidents.state = 7; 
        childIncidents.close_notes = 'Closed because the parent incident was closed.';
        childIncidents.update(); 
    }


})(current, previous);

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Here in this Video, I have covered the Custom Application Pattern Troubleshooting and configuration Thank you for visiting my channel. Here, I'll share various technical knowledge. Feel free to reach out to me directly for any Service Now-related queries. Your support encourages me to consistently

Dr Atul G- LNG
Tera Patron

I echo with Ankur. The BR is OOTB to resolved the child incidents but closure will work on individual level.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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