Close Child Incidents without closing Parent incident

Praveen55
Kilo Explorer

Hello All,

Am new to Servicenow and trying to explore stuff for daily activities. We come across cases where multiple alerts (incidents) trigger for an issue and have to end up creating a parent and linking others to it. 

While we investigate on the parent incident, have to close the child incidents. I would need your support on this activity

Child incidents can be in any State (new, in progress) but have to close all without closing Parent

Kindly assist

14 REPLIES 14

You may create a UI action on the Parent Incident.

On click of the button, close all related child incidents.

You can try with below script in the UI action.

 

var inc = new GlideRecord('incident');

inc.addQuery('parent_incident',current.sys_id);

inc.query();

 

while (inc.next())

{

inc.state=3;

inc.close_notes='Closing from parent incident';

inc.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

I have created UI action: Cancel Child Incident with the provided script. However, using the UI action, the Child incident moved to State: On Hold from new instead of Resolve\Close

use below. Note the line marked in bold

 

var inc = new GlideRecord('incident');

inc.addQuery('parent_incident',current.sys_id);

inc.query();

 

while (inc.next())

{

inc.state=6; //Use 7 for Closed and 8 for Cancelled

inc.close_notes='Closing from parent incident';

inc.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

Hurray.. It worked.. 

 

Just want to know on conditions for it to use from List Botton button as it appeared but didn't work. Also, will this UI action be available for all users ?

 

I have made it available under Form Context Menu, which is working absolutely fine

Can I get a condition added to the script, so that it is visible only to a parent incident i.e. only when the field Parent Incident (under Related records) is having a value