Facing issue while closing Parent Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 07:16 AM
We are getting a pop up to first close all the child incidents by updating the CI details when we trying to close the parent incident. This is a very time taking manual process as we tag 10-15 child incidents to a parent incident.
Please advise how it can be fixed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 04:18 PM
@Waquar This can be addressed by creating an on After update business rule on the incident table with the following conditions.
Parent is Empty
AND
State changes to Closed
Here is the script.
var grChild = new GlideRecord('incident');
grChild.addQuery('parent', current.sys_id);
grChild.query();
while (grChild.next()) {
grChild.state = 7; // Set state to Closed
grChild.cmdb_ci = current.cmdb_ci; // Update the CI field
grChild.update();
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 08:28 PM - edited 12-19-2024 10:57 PM
Hi @Waquar ,
create after update business rule state changes and parent is empty.
(function executeRule(current, previous /*null when async*/) {
var childIncidents = new GlideRecord('incident');
childIncidents.addQuery('parent', current.sys_id);
childIncidents.addActiveQuery();
childIncidents.query();
while (childIncidents.next()) {
childIncidents.state = 7;
childIncidents.cmdb_ci= current.cmdb_ci;
childIncidents.update();
}
})(current, previous);
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:23 PM
Hi @Waquar ,
Check the before BR which is running to prevent closing the incident if child incident are open. You need to change the logic there as this functionality is not OOB. Instead of preventing you can close the child incident by using below script.
var grChild = new GlideRecord('incident');
grChild.addQuery('parent', current.sys_id);
grChild.query();
while (grChild.next()) {
grChild.state = current.state; // Set state to Closed
grChild.update();
}
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:57 PM
To fix this, create a Business Rule or a Flow Designer automation to automatically update and close all child incidents when the parent incident is closed. This eliminates the need for manual updates.