Display Incident Count with Child Incident Numbers using Display Business Rule
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 05:03 AM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 07:03 AM - edited ‎02-24-2025 07:04 AM
Hi @abhisnow020
You can write below script in Display business rule.
var agg = new GlideAggregate('incident');
agg.addQuery('parent_incident', current.sys_id);
agg.addAggregate('COUNT');
agg.query();
if (agg.next()) {
g_scratchpad.childIncCount = agg.getAggregate('COUNT');
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 07:11 AM
@abhisnow020 Here is the BR.
Script.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var grChild = new GlideAggregate('incident');
grChild.addQuery('parent', current.sys_id);
grChild.addAggregate('COUNT');
grChild.query();
if (grChild.next()); {
gs.addInfoMessage('Number of child incidents ' + grChild.getAggregate('COUNT'));
}
})(current, previous);