Categories:

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);
}

Total Views: 1294

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *