-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a script to get the count of incidents by priority under each…
… category. (#1617)
- Loading branch information
1 parent
c07ffe7
commit c71bf3f
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
GlideAggregate/List the incident priority count under each category/code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
GlideAggregate/List the incident priority count under each category/readme.MD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|