Skip to content

Commit

Permalink
Created a script to get the count of incidents by priority under each…
Browse files Browse the repository at this point in the history
… category. (#1617)
  • Loading branch information
vijaytalupula authored Nov 1, 2024
1 parent c07ffe7 commit c71bf3f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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'));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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



0 comments on commit c71bf3f

Please sign in to comment.