diff --git a/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js b/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js new file mode 100644 index 0000000000..e6b1b099c1 --- /dev/null +++ b/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js @@ -0,0 +1,15 @@ +(function() { + var priorities = {}; + var agg = new GlideAggregate('incident'); + agg.addAggregate('COUNT'); + agg.groupBy('priority'); + agg.query(); + while (agg.next()) { + var priority = agg.getDisplayValue('priority') || 'No Priority Set'; + var count = agg.getAggregate('COUNT'); + priorities[priority] = parseInt(count, 10); + } + for (var priority in priorities) { + gs.info('Priority: ' + priority + ' | Count: ' + priorities[priority]); + } +})(); diff --git a/Server-Side Components/Background Scripts/Get incident count based on priority/README.md b/Server-Side Components/Background Scripts/Get incident count based on priority/README.md new file mode 100644 index 0000000000..cce3e61a7e --- /dev/null +++ b/Server-Side Components/Background Scripts/Get incident count based on priority/README.md @@ -0,0 +1 @@ +//To get the incident count based on priority.