Skip to content

Commit 52ef6a8

Browse files
authored
Create Incident_analysis_Resolution_Calculation_GlideAggregate.js
1 parent d03b88d commit 52ef6a8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-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+
}

0 commit comments

Comments
 (0)