From a8ecb1931d8602b543f270ad9d6b8b6a3a075488 Mon Sep 17 00:00:00 2001 From: Dhruv Yadav <43941048+Dhruvyadav2000@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:51:46 +0530 Subject: [PATCH] Update Incident_analysis_Resolution_Calculation_GlideAggregate.js 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. --- ...cident_analysis_Resolution_Calculation_GlideAggregate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GlideAggregate/Incident Analysis and Resolution Calculation using Glideaggregate/Incident_analysis_Resolution_Calculation_GlideAggregate.js b/GlideAggregate/Incident Analysis and Resolution Calculation using Glideaggregate/Incident_analysis_Resolution_Calculation_GlideAggregate.js index 4ec099797f..250727eb90 100644 --- a/GlideAggregate/Incident Analysis and Resolution Calculation using Glideaggregate/Incident_analysis_Resolution_Calculation_GlideAggregate.js +++ b/GlideAggregate/Incident Analysis and Resolution Calculation using Glideaggregate/Incident_analysis_Resolution_Calculation_GlideAggregate.js @@ -5,8 +5,8 @@ ga.addAggregate('COUNT', 'number'); ga.addAggregate('AVG', 'time_to_close'); ga.query(); while (ga.next()) { - var assigned_to = ga.get('assigned_to'); - var count = ga.get('result'); - var avgTimeToClose = ga.get('result.avg_time_to_close'); + var assigned_to = ga.getDisplayValue('assigned_to'); + var count = ga.getAggregate('COUNT', 'number'); + var avgTimeToClose = ga.getAggregate('AVG', 'time_to_close'); gs.info('Assigned to: ' + assigned_to + ', Incident Count: ' + count + ', Average Time to Close: ' + avgTimeToClose); }