Close parent incident when the child incidents is closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 05:08 AM
Hi,
I have a requirement that a Parent incident should get closed automatically if all the associated child incidents are closed.
A solution will be helpful.
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 05:13 AM
Hi Shruthi,
Try this with after business rule.
condition:current.active.changesTo(false) && current.parent.sys_class_name == 'incident'
(function executeRule(current, previous /*null when async*/) {
// Query for associated records related to the same parent
var inc = new GlideRecord('incident');
inc.addQuery('parent', current.parent); // Records related to same parent
inc.addQuery('sys_id','!=', current.sys_id); // Exclude this record
inc.addActiveQuery();
inc.query();
c=inc.getrowcount();
gs.addInfoMessage("entered query");
if (!inc.next()) {
// If there are no other active records associated to the same parent
// Close the parent
gs.addInfoMessage("entered next look");
var parInc = new GlideRecord('incident');
parInc.get(current.getValue('parent'));
parInc.state = 7; // Close the incident
parInc.active = false;
parInc.update();
}
})(current, previous);
Use parent_incident instead of parent in case latter doesn't work.
Mark my answer as correct or hit like based on impact
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2022 11:13 PM
hi i have a requirement same kind of.
user can select multiple groups on my parent table and it creates diferrent task for each group selected. but i want to autoclose the parent record if all the task of the groups is closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 05:23 AM
Hello, where have you used this parameter? c=inc.getrowcount(); Can you also check the code again and paste here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 06:03 AM
Hello, the code works till 'gs.addInfoMessage("entered query");' . However it seem that you need to include