Skip to content

Commit 15b7574

Browse files
authored
Improve README.md for GlideAggregate Query
I updated the README.md file for the GlideAggregate Query script. This improved README.md file explains what the script does and how it is used.
1 parent 5804e23 commit 15b7574

File tree

1 file changed

+23
-2
lines changed
  • Core ServiceNow APIs/GlideAggregate/Count incidents based on category

1 file changed

+23
-2
lines changed
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1-
Go to background and execute the script then you will get the total count of incidents based on category.
1+
A background script that aggregates incident records by category and counts how many incidents exist in each category.
22

3-
It will easily help to segregate the data based on categories/priority/ etc anything.
3+
## How it works
4+
5+
The script:
6+
1. Creates a `GlideAggregate` query on the "incident" table.
7+
2. Adds a COUNT aggregation on the "category" field to count the incidents per category.
8+
3. Orders results alphabetically by category.
9+
4. Executes the query and loops through the results.
10+
5. Logs the counts for each category to the system log.
11+
12+
## Sample Output
13+
14+
```
15+
The total number of Hardware categories is 25
16+
The total number of Network categories is 42
17+
The total number of Software categories is 58
18+
```
19+
20+
## Configuration Options
21+
22+
- **Variable naming**: The `categories` should be a singular "category" since it holds one value at a time.
23+
- **Missing encoding**: It should use `incidents.getValue('category') for proper encoding.
24+
- **No null handling**: Any categories with no value will show as empty.

0 commit comments

Comments
 (0)