How to Close child ncidents

Community Alums
Not applicable

Create an incident say A. Create two more incidents say B & C. Associate B & C as child incidents to incidents A. If Incident A is closed, child incidents B & C should be closed automatically.

3 REPLIES 3

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

You need to write async business rule on incident table like below and add condition "state is closed".

 

var grinc=new GlideRecord('incident');
grinc.addQuery('parent_incident',current.sys_id);
grinc.query();
while(grinc.next())
{
grinc.setValue('state',7);
grinc.update();
}

 

Please mark my answer as helpful/correct if it helps you.

Regards,

Namrata

Basheer
Mega Sage

Hi @Community Alums ,

Create a BR and code as below

var inc=new GlideRecord('incident');
inc.addQuery('parent_incident',current.sys_id);
inc.query();
while(inc.next())
{
inc.state = 7;
inc.incident_state =7;
inc.comments = "Parent closed : "+current.number;
inc.active = false;
inc.update();
}

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

OlaN
Giga Sage
Giga Sage

Hi,

This could also be done with a simple flow, no scripting required.

Example below.

I would recommend to go the non-scripting approach whenever possible.

 

flow-close-child-incidents.png