
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 05:25 AM
Hi,
My doubt is that once we receive a flood(>100) of incidents in 5 min time then from those incidents can we separate or group incidents based on CI ? and once we sort or group them by CI if there are more than 10 incidents in any groups then for that group can we create a major incident and attach the remaining incidents to the major incident? is there any way in scripting to achieve this? if so please help
Thanks
Datta
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2022 12:45 AM
Hi,
try this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var agg = new GlideAggregate('incident');
agg.addAggregate('COUNT', 'cmdb_ci');
agg.addEncodedQuery('sys_created_onRELATIVEGT@minute@ago@60');
agg.addQuery('cmdb_ci', current.cmdb_ci);
agg.query();
while (agg.next()) {
//do things on the results
var incidentCount = agg.getAggregate('COUNT', 'cmdb_ci');
gs.addInfoMessage('Total incidents for this CI ' + incidentCount);
if(incidentCount > 20){
// your logic
}
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 05:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 05:42 AM
Hi Jaspal,
Thanks for the reply, But I am looking for a script to do it
And I am looking to automate the whole process mentioned above
Thanks
Datta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 05:49 AM
You need to use GlideAggregate. Look for link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 06:03 AM
Hi,
Use GlideAggregate and get the count
Link already shared by Jaspal
You can start from your side and it would be learning for you as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader