From 9d0add9b88f5aee9fb879fc75e14296ce18567b2 Mon Sep 17 00:00:00 2001 From: vijaytalupula <30828543+vijaytalupula@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:36:42 +0530 Subject: [PATCH 1/3] Create readme.MD --- .../readme.MD | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 GlideAggregate/List the incident priority count under each category/readme.MD diff --git a/GlideAggregate/List the incident priority count under each category/readme.MD b/GlideAggregate/List the incident priority count under each category/readme.MD new file mode 100644 index 0000000000..e564a9fdd1 --- /dev/null +++ b/GlideAggregate/List the incident priority count under each category/readme.MD @@ -0,0 +1,4 @@ +This piece of code will be helpful to get the count of incidents by Priority under each Category. + + + From 325e0870e11a797cba92963169af7f53409f5acf Mon Sep 17 00:00:00 2001 From: vijaytalupula <30828543+vijaytalupula@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:39:28 +0530 Subject: [PATCH 2/3] Count of Incidents by Category by Priority. --- .../code.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 GlideAggregate/List the incident priority count under each category/code.js diff --git a/GlideAggregate/List the incident priority count under each category/code.js b/GlideAggregate/List the incident priority count under each category/code.js new file mode 100644 index 0000000000..e01997c73b --- /dev/null +++ b/GlideAggregate/List the incident priority count under each category/code.js @@ -0,0 +1,20 @@ +// Get the count of Incidents by Category and then by Priority. + +var incCATGR = new GlideAggregate('incident'); +incCATGR.addAggregate('COUNT', 'category'); +incCATGR.orderBy('category'); +incCATGR.query(); + +while (incCATGR.next()) { + var cat = incCATGR.category; + gs.print("Category Name: " +incCATGR.category.getDisplayValue() + ' --> ' + incCATGR.getAggregate('COUNT', 'category')); + var incPriorityGR = new GlideAggregate('incident'); + incPriorityGR.addQuery('category', incCATGR.category); + incPriorityGR.addAggregate('COUNT', 'priority'); + incPriorityGR.orderBy('priority'); + incPriorityGR.query(); + + while(incPriorityGR.next()){ + gs.print("Priority-" +incPriorityGR.priority + " = " +incPriorityGR.getAggregate('COUNT', 'priority')); + } +} From 615896713228651e91a401f918838e7545969e26 Mon Sep 17 00:00:00 2001 From: vijaytalupula <30828543+vijaytalupula@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:40:56 +0530 Subject: [PATCH 3/3] Count of Incidents by Category by Priority. --- .../readme.MD | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/GlideAggregate/List the incident priority count under each category/readme.MD b/GlideAggregate/List the incident priority count under each category/readme.MD index e564a9fdd1..68c5899981 100644 --- a/GlideAggregate/List the incident priority count under each category/readme.MD +++ b/GlideAggregate/List the incident priority count under each category/readme.MD @@ -1,4 +1,37 @@ -This piece of code will be helpful to get the count of incidents by Priority under each Category. +Purpose: This piece of code will be helpful to get the count of incidents by Priority under each Category. + +Sample Output: +============== +*** Script: Category Name: --> 4 +*** Script: Priority-1 = 2 +*** Script: Priority-2 = 1 +*** Script: Priority-4 = 1 +*** Script: Category Name: Database --> 3 +*** Script: Priority-1 = 1 +*** Script: Priority-4 = 1 +*** Script: Priority-5 = 1 +*** Script: Category Name: Hardware --> 10 +*** Script: Priority-1 = 5 +*** Script: Priority-3 = 2 +*** Script: Priority-5 = 3 +*** Script: Category Name: Inquiry / Help --> 84 +*** Script: Priority-1 = 10 +*** Script: Priority-2 = 2 +*** Script: Priority-3 = 13 +*** Script: Priority-4 = 17 +*** Script: Priority-5 = 42 +*** Script: Category Name: Network --> 12 +*** Script: Priority-1 = 2 +*** Script: Priority-2 = 2 +*** Script: Priority-3 = 1 +*** Script: Priority-4 = 2 +*** Script: Priority-5 = 5 +*** Script: Category Name: Software --> 131 +*** Script: Priority-1 = 15 +*** Script: Priority-2 = 15 +*** Script: Priority-3 = 23 +*** Script: Priority-4 = 28 +*** Script: Priority-5 = 50