Group by Category Name for ServiceNow
//Number of incidents varies depending on the current state
var count = new GlideAggregate('incident');
//count.addQuery('active', '=','true');
count.addAggregate('COUNT', 'category');
count.query();
while (count.next()) {
var category = count.category;
var categoryCount = count.getAggregate('COUNT', 'category');
gs.info("There are currently " + categoryCount + " incidents with a category of " + category);
}
//Number of incidents varies depending on the current state
var count = new GlideAggregate('incident');
//count.addQuery('active', '=','true');
count.addAggregate('COUNT', 'category');
count.query();
while (count.next()) {
var category = count.category;
var categoryCount = count.getAggregate('COUNT', 'category');
gs.info("There are currently " + categoryCount + " incidents with a category of " + category);
}
//Number of incidents varies depending on the current state var count = new GlideAggregate('incident'); //count.addQuery('active', '=','true'); count.addAggregate('COUNT', 'category'); count.query(); while (count.next()) { var category = count.category; var categoryCount = count.getAggregate('COUNT', 'category'); gs.info("There are currently " + categoryCount + " incidents with a category of " + category); }
No responses yet