From 17d67908ea0c4f5b070a2460999f2f1d57a2f631 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:06:07 +0530 Subject: [PATCH 1/3] Create getBreachedIncidentCountByGroup.js GlideAggregate script to count the breached incidents by assignment group. --- .../getBreachedIncidentCountByGroup.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/getBreachedIncidentCountByGroup.js diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/getBreachedIncidentCountByGroup.js b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/getBreachedIncidentCountByGroup.js new file mode 100644 index 0000000000..5f552b6072 --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/getBreachedIncidentCountByGroup.js @@ -0,0 +1,24 @@ +function getBreachedIncidentCountByGroup() { + var result = []; + + var ga = new GlideAggregate('task_sla'); + ga.addAggregate('COUNT'); + ga.groupBy('task.assignment_group'); + ga.addQuery('task.sys_class_name', 'incident'); + ga.addQuery('task.active', true); + ga.addQuery('has_breached', true); + ga.query(); + + while(ga.next()){ + var grpName = ga.getValue('task.assignment_group.name') || 'No Group'; + var count = ga.getAggregate('COUNT'); + + result.push({ + assignment_group: grpName, + breached_incident_count: parseInt(count, 10) + }); + + gs.info('Assignment Group: ' + grpName + ' - Breached Incidents: ' + count); + } + return result; +} From 95fee2ab39d5ce33f8f8dd6ebf6a6313cc973a3e Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:17:10 +0530 Subject: [PATCH 2/3] Create README.md --- .../SLA Breach Count by Assignment Group/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md new file mode 100644 index 0000000000..605eb57f8a --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md @@ -0,0 +1,8 @@ +**SLA Breached Incident Count by Assignment Group** +This script uses the GlideAggregate API to calculate the total number incidents with breached SLAs, grouped by their assignment group. + +**Description** +This snippet demonstrates how to use GlideAggregate to efficiently group and count ServiceNow records. It retrieves the number of incidents for which SLAs have been breached, grouped by each assignment group. + +**Use Case** +This is useful for identifying which support groups have the highest number of SLA breaches, helping improve response and resolution performance. From 878ee1ab0e72bf7d6261e4682bdfff0df051e081 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:18:35 +0530 Subject: [PATCH 3/3] Update README.md --- .../SLA Breach Count by Assignment Group/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md index 605eb57f8a..08b13c2d0c 100644 --- a/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md +++ b/Core ServiceNow APIs/GlideAggregate/SLA Breach Count by Assignment Group/README.md @@ -1,8 +1,8 @@ -**SLA Breached Incident Count by Assignment Group** -This script uses the GlideAggregate API to calculate the total number incidents with breached SLAs, grouped by their assignment group. +**SLA Breached Incident Count by Assignment Group:** +This script uses the GlideAggregate API to calculate the total number of incidents with breached SLAs, grouped by their assignment group. -**Description** +**Description:** This snippet demonstrates how to use GlideAggregate to efficiently group and count ServiceNow records. It retrieves the number of incidents for which SLAs have been breached, grouped by each assignment group. -**Use Case** +**Use Case:** This is useful for identifying which support groups have the highest number of SLA breaches, helping improve response and resolution performance.