We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa52e46 commit c8e0797Copy full SHA for c8e0797
Core ServiceNow APIs/GlideAggregate/Top 5 Users with Most Incidents/top 5 users
@@ -0,0 +1,14 @@
1
+var ga = new GlideAggregate('incident');
2
+ga.addAggregate('COUNT', 'sys_id');
3
+ga.groupBy('caller_id');
4
+ga.orderByAggregate('COUNT','sys_id');
5
+ga.setLimit(4);
6
+ga.query();
7
+
8
9
+while (ga.next()) {
10
+ var count = ga.getAggregate('COUNT', 'sys_id'); //get the count
11
+ var userName = ga.getDisplayValue('caller_id');//get user's userName
12
13
+ gs.log('user: ' + userName + ', Incident count: ' + count);//print out the result
14
+}
0 commit comments