Skip to content

Commit f575a51

Browse files
authored
IncidentCount.js
1 parent 07aac64 commit f575a51

File tree

1 file changed

+15
-0
lines changed
  • Server-Side Components/Background Scripts/Get incident count based on priority

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function() {
2+
var priorities = {};
3+
var agg = new GlideAggregate('incident');
4+
agg.addAggregate('COUNT');
5+
agg.groupBy('priority');
6+
agg.query();
7+
while (agg.next()) {
8+
var priority = agg.getDisplayValue('priority') || 'No Priority Set';
9+
var count = agg.getAggregate('COUNT');
10+
priorities[priority] = parseInt(count, 10);
11+
}
12+
for (var priority in priorities) {
13+
gs.info('Priority: ' + priority + ' | Count: ' + priorities[priority]);
14+
}
15+
})();

0 commit comments

Comments
 (0)