Close Child Incidents without closing Parent incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 12:38 AM
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
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 11:28 AM
Sorry. I missed your question.
Try this condition
var inc = new GlideRecord('incident');inc.addQuery('active','true');iinc.addQuery('parent_incident',current.sys_id);inc.query();if (inc.next()) true; else false;
Please mark my response correct if it worked for you
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 06:36 PM
Before trying the provided condition, I have mentioned the below for making the UI action visible to certain groups only
gs.getUser().isMemberOf('Group 1') || gs.getUser().isMemberOf('Group 2 ') || gs.getUser().isMemberOf('Group 3') || gs.getUser().isMemberOf('Group 4')
How do I add more groups for them to view the UI action and also how can I add the condition provided by you together ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 10:20 PM
I would suggest writing a classless script include and then call it in the condition as showCancel()
function showCancel()
{
if (gs.getUser().isMemberOf('Group 1') || gs.getUser().isMemberOf('Group 2 ') || gs.getUser().isMemberOf('Group 3') || gs.getUser().isMemberOf('Group 4'))
{
var inc = new GlideRecord('incident');
inc.addQuery('active','true');
iinc.addQuery('parent_incident',current.sys_id);
inc.query();
if (inc.next())
return true;
}
return false;
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2018 12:17 AM
Unfortunately, its not working with the below script
- Its visible to all members whoever is not member of the Group 1
function showCancel()
{
if (gs.getUser().isMemberOf('Group 1'))
{
var inc = new GlideRecord('incident');
inc.addQuery('active','true');
inc.addQuery('parent_incident',current.sys_id);
inc.query();
if (inc.next())
inc.state=6;
inc.close_notes='Closing from parent incident';
inc.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 01:55 PM
You were supposed to be creating a script include. And then call the function in condition as showCancel()
function showCancel()
{
if (gs.getUser().isMemberOf('Group 1') || gs.getUser().isMemberOf('Group 2 ') || gs.getUser().isMemberOf('Group 3') || gs.getUser().isMemberOf('Group 4'))
{
var inc = new GlideRecord('incident');
inc.addQuery('active','true');
iinc.addQuery('parent_incident',current.sys_id);
inc.query();
if (inc.next())
return true;
}
return false;
}
Please mark this response as correct or helpful if it assisted you with your question.