diff --git a/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents b/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents new file mode 100644 index 0000000000..d97789ad84 --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents @@ -0,0 +1,14 @@ +var ga = new GlideAggregate('incident'); +ga.addAggregate('COUNT', 'sys_id'); +ga.groupBy('caller_id'); +ga.orderByAggregate('COUNT','sys_id'); +ga.setLimit(4); +ga.query(); + + +while (ga.next()) { + var count = ga.getAggregate('COUNT', 'sys_id'); + var userName = ga.getDisplayValue('caller_id'); + + gs.log('user: ' + userName + ', Incident count: ' + count); +}