Skip to content

Commit 5b0f5c8

Browse files
authored
Active sla count by assignment group (#1297)
* Create SLA Count by Assignment Group.js * Create readme.md
1 parent 9cd132c commit 5b0f5c8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var slaAgg = new GlideAggregate('task_sla');
2+
slaAgg.addQuery('task.active', true); // Only active tasks
3+
slaAgg.groupBy('task.assignment_group'); // Group by assignment group
4+
slaAgg.addAggregate('COUNT'); // Count the number of active SLAs per assignment group
5+
slaAgg.query();
6+
7+
while (slaAgg.next()) {
8+
var assignmentGroup = slaAgg.getValue('task.assignment_group.name');
9+
var slaCount = slaAgg.getAggregate('COUNT');
10+
gs.info('Assignment Group: ' + assignmentGroup + ' has ' + slaCount + ' active SLAs.');
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SLA Count by Assignment Group
2+
3+
This script retrieves active SLAs (task_sla table) grouped by assignment groups in ServiceNow. It counts the number of active SLAs per group and logs the result, displaying the group name and corresponding SLA count.

0 commit comments

Comments
 (0)