File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
GlideAggregate/List the incident priority count under each category Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Get the count of Incidents by Category and then by Priority.
2
+
3
+ var incCATGR = new GlideAggregate ( 'incident' ) ;
4
+ incCATGR . addAggregate ( 'COUNT' , 'category' ) ;
5
+ incCATGR . orderBy ( 'category' ) ;
6
+ incCATGR . query ( ) ;
7
+
8
+ while ( incCATGR . next ( ) ) {
9
+ var cat = incCATGR . category ;
10
+ gs . print ( "Category Name: " + incCATGR . category . getDisplayValue ( ) + ' --> ' + incCATGR . getAggregate ( 'COUNT' , 'category' ) ) ;
11
+ var incPriorityGR = new GlideAggregate ( 'incident' ) ;
12
+ incPriorityGR . addQuery ( 'category' , incCATGR . category ) ;
13
+ incPriorityGR . addAggregate ( 'COUNT' , 'priority' ) ;
14
+ incPriorityGR . orderBy ( 'priority' ) ;
15
+ incPriorityGR . query ( ) ;
16
+
17
+ while ( incPriorityGR . next ( ) ) {
18
+ gs . print ( "Priority-" + incPriorityGR . priority + " = " + incPriorityGR . getAggregate ( 'COUNT' , 'priority' ) ) ;
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments