Skip to content

Commit 56a5185

Browse files
authored
Merge pull request #1386 from Paulsylo25/Clientscripts_NewBR
2 parents dfc1015 + 52ef6a8 commit 56a5185

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var ga = new GlideAggregate('incident');
2+
ga.addQuery('state', '!=', 'Closed'); // Filter for open incidents only
3+
ga.groupBy('assigned_to');
4+
ga.addAggregate('COUNT', 'number');
5+
ga.addAggregate('AVG', 'time_to_close');
6+
ga.query();
7+
while (ga.next()) {
8+
var assigned_to = ga.get('assigned_to');
9+
var count = ga.get('result');
10+
var avgTimeToClose = ga.get('result.avg_time_to_close');
11+
gs.info('Assigned to: ' + assigned_to + ', Incident Count: ' + count + ', Average Time to Close: ' + avgTimeToClose);
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
These scripts explain the usage of Glideaggregate. This script helps to group the incidents by their assigned user, counts the number of incidents assigned to each user, and calculates the average time it takes to close these incidents.

0 commit comments

Comments
 (0)