From 653b1a32ec9fe97f627730491314309e324194f0 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Fri, 24 Oct 2025 22:37:34 +0100 Subject: [PATCH 1/5] Create SLA Compliance Ratio by Assignment Group This script calculates the SLA breach percentage for each assignment group based on closed incidents in ServiceNow. It leverages GlideAggregate to count both total SLAs and breached SLAs efficiently, providing key SLA performance insights. --- .../SLA Compliance Ratio by Assignment Group | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group new file mode 100644 index 0000000000..96f833baca --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group @@ -0,0 +1,20 @@ +Glide Aggregate Script- + +(function() { + var ga = new GlideAggregate('task_sla'); + ga.addEncodedQuery('task.sys_class_name=incident^active=false'); + ga.addAggregate('COUNT'); // All SLAs + ga.addAggregate('COUNT', 'breach', 'true'); // breached SLAs + ga.groupBy('task.assignment_group'); + ga.query(); + + gs.info('SLA Compliance Ratio by Group'); + + while (ga.next()) { + var total = parseInt(ga.getAggregate('COUNT')); + var breached = parseInt(ga.getAggregate('COUNT', 'breach', 'true')); + var rate = breached ? ((breached / total) * 100).toFixed(2) : 0; + gs.info(ga.getDisplayValue('task.assignment_group') + ': ' + rate + '% breached (' + breached + '/' + total + ')'); + } +})(); + From cff1583dc51287d10c29f72bb722835a9c40e962 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Fri, 24 Oct 2025 22:41:14 +0100 Subject: [PATCH 2/5] Update SLA Compliance Ratio by Assignment Group --- .../SLA Compliance Ratio by Assignment Group | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group index 96f833baca..1933f94264 100644 --- a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group +++ b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group @@ -18,3 +18,27 @@ Glide Aggregate Script- } })(); + +Readme: + +This script calculates the SLA breach percentage for each assignment group based on closed incidents in ServiceNow. +It leverages GlideAggregate to count both total SLAs and breached SLAs efficiently, providing key SLA performance insights. + +Useful for: + • SLA dashboards + • Support performance tracking + • Service improvement reports + +Objective + +To determine, for each assignment group: + • How many SLAs were closed + • How many of those breached + • The resulting SLA compliance percentage + +Script Logic + 1. Query the task_sla table. + 2. Filter for closed SLAs linked to incidents. + 3. Aggregate total SLAs (COUNT) and breached SLAs (COUNT, 'breach', 'true'). + 4. Group results by assignment group. + 5. Calculate breach percentage. From 9d499e303097fff4e3bbda87a48dd43d496d642e Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Fri, 24 Oct 2025 22:47:11 +0100 Subject: [PATCH 3/5] Delete Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group --- .../SLA Compliance Ratio by Assignment Group | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group deleted file mode 100644 index 1933f94264..0000000000 --- a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group +++ /dev/null @@ -1,44 +0,0 @@ -Glide Aggregate Script- - -(function() { - var ga = new GlideAggregate('task_sla'); - ga.addEncodedQuery('task.sys_class_name=incident^active=false'); - ga.addAggregate('COUNT'); // All SLAs - ga.addAggregate('COUNT', 'breach', 'true'); // breached SLAs - ga.groupBy('task.assignment_group'); - ga.query(); - - gs.info('SLA Compliance Ratio by Group'); - - while (ga.next()) { - var total = parseInt(ga.getAggregate('COUNT')); - var breached = parseInt(ga.getAggregate('COUNT', 'breach', 'true')); - var rate = breached ? ((breached / total) * 100).toFixed(2) : 0; - gs.info(ga.getDisplayValue('task.assignment_group') + ': ' + rate + '% breached (' + breached + '/' + total + ')'); - } -})(); - - -Readme: - -This script calculates the SLA breach percentage for each assignment group based on closed incidents in ServiceNow. -It leverages GlideAggregate to count both total SLAs and breached SLAs efficiently, providing key SLA performance insights. - -Useful for: - • SLA dashboards - • Support performance tracking - • Service improvement reports - -Objective - -To determine, for each assignment group: - • How many SLAs were closed - • How many of those breached - • The resulting SLA compliance percentage - -Script Logic - 1. Query the task_sla table. - 2. Filter for closed SLAs linked to incidents. - 3. Aggregate total SLAs (COUNT) and breached SLAs (COUNT, 'breach', 'true'). - 4. Group results by assignment group. - 5. Calculate breach percentage. From 85317b137097ec927ca2b88c5793f97c308b7649 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Fri, 24 Oct 2025 22:48:23 +0100 Subject: [PATCH 4/5] Created script.js --- .../script.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/script.js diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/script.js b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/script.js new file mode 100644 index 0000000000..815ab9d465 --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/script.js @@ -0,0 +1,17 @@ +(function() { + var ga = new GlideAggregate('task_sla'); + ga.addEncodedQuery('task.sys_class_name=incident^active=false'); + ga.addAggregate('COUNT'); // All SLAs + ga.addAggregate('COUNT', 'breach', 'true'); // breached SLAs + ga.groupBy('task.assignment_group'); + ga.query(); + + gs.info('SLA Compliance Ratio by Group'); + + while (ga.next()) { + var total = parseInt(ga.getAggregate('COUNT')); + var breached = parseInt(ga.getAggregate('COUNT', 'breach', 'true')); + var rate = breached ? ((breached / total) * 100).toFixed(2) : 0; + gs.info(ga.getDisplayValue('task.assignment_group') + ': ' + rate + '% breached (' + breached + '/' + total + ')'); + } +})(); From 92771219a1d2f941653768866124127faee54a4d Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Fri, 24 Oct 2025 22:51:07 +0100 Subject: [PATCH 5/5] Created readme.md --- .../readme.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/readme.md diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/readme.md b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/readme.md new file mode 100644 index 0000000000..a85f5490ec --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/SLA Compliance Ratio by Assignment Group/readme.md @@ -0,0 +1,23 @@ +Overview + +This script calculates the SLA breach percentage for each assignment group based on closed incidents in ServiceNow. +It leverages GlideAggregate to count both total SLAs and breached SLAs efficiently, providing key SLA performance insights. + +Useful for: + • SLA dashboards + • Support performance tracking + • Service improvement reports + +Objective + +To determine, for each assignment group: + • How many SLAs were closed + • How many of those breached + • The resulting SLA compliance percentage + +Script Logic + 1. Query the task_sla table. + 2. Filter for closed SLAs linked to incidents. + 3. Aggregate total SLAs (COUNT) and breached SLAs (COUNT, 'breach', 'true'). + 4. Group results by assignment group. + 5. Calculate breach percentage.