Skip to content

Commit 9021722

Browse files
Update Incident_analysis_Resolution_Calculation_GlideAggregate.js (#1624)
Fix GlideAggregate query and data retrieval for incident statistics - Updated the method to retrieve the 'assigned_to' field using getDisplayValue() instead of get(). - Corrected aggregate data retrieval by using getAggregate() for 'COUNT' and 'AVG' operations. - Ensured proper calculation and output of open incidents count and average time to close.
1 parent 1a42357 commit 9021722

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

GlideAggregate/Incident Analysis and Resolution Calculation using Glideaggregate/Incident_analysis_Resolution_Calculation_GlideAggregate.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ga.addAggregate('COUNT', 'number');
55
ga.addAggregate('AVG', 'time_to_close');
66
ga.query();
77
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');
8+
var assigned_to = ga.getDisplayValue('assigned_to');
9+
var count = ga.getAggregate('COUNT', 'number');
10+
var avgTimeToClose = ga.getAggregate('AVG', 'time_to_close');
1111
gs.info('Assigned to: ' + assigned_to + ', Incident Count: ' + count + ', Average Time to Close: ' + avgTimeToClose);
1212
}

0 commit comments

Comments
 (0)