From bb69ba1a5bc8d449cde8b72def9fafdb739ecfc1 Mon Sep 17 00:00:00 2001 From: ShuGitHub2022 <107590375+ShuGitHub2022@users.noreply.github.com> Date: Tue, 7 Oct 2025 13:46:17 -0700 Subject: [PATCH] Create a new branch for this commit and start a pull request --- .../Top 5 users create the most incidents | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents diff --git a/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents b/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents new file mode 100644 index 0000000000..d97789ad84 --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/Top 5 users create the most incidents @@ -0,0 +1,14 @@ +var ga = new GlideAggregate('incident'); +ga.addAggregate('COUNT', 'sys_id'); +ga.groupBy('caller_id'); +ga.orderByAggregate('COUNT','sys_id'); +ga.setLimit(4); +ga.query(); + + +while (ga.next()) { + var count = ga.getAggregate('COUNT', 'sys_id'); + var userName = ga.getDisplayValue('caller_id'); + + gs.log('user: ' + userName + ', Incident count: ' + count); +}