From 15b757416486eec93a02c44e59e44f378947d11b Mon Sep 17 00:00:00 2001 From: Benjamin Yee Date: Sun, 19 Oct 2025 17:59:39 -0700 Subject: [PATCH] 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. --- .../README.md | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Core ServiceNow APIs/GlideAggregate/Count incidents based on category/README.md b/Core ServiceNow APIs/GlideAggregate/Count incidents based on category/README.md index 8f30d329f9..4162c96606 100644 --- a/Core ServiceNow APIs/GlideAggregate/Count incidents based on category/README.md +++ b/Core ServiceNow APIs/GlideAggregate/Count incidents based on category/README.md @@ -1,3 +1,24 @@ -Go to background and execute the script then you will get the total count of incidents based on category. +A background script that aggregates incident records by category and counts how many incidents exist in each category. -It will easily help to segregate the data based on categories/priority/ etc anything. +## How it works + +The script: +1. Creates a `GlideAggregate` query on the "incident" table. +2. Adds a COUNT aggregation on the "category" field to count the incidents per category. +3. Orders results alphabetically by category. +4. Executes the query and loops through the results. +5. Logs the counts for each category to the system log. + +## Sample Output + +``` +The total number of Hardware categories is 25 +The total number of Network categories is 42 +The total number of Software categories is 58 +``` + +## Configuration Options + +- **Variable naming**: The `categories` should be a singular "category" since it holds one value at a time. +- **Missing encoding**: It should use `incidents.getValue('category') for proper encoding. +- **No null handling**: Any categories with no value will show as empty.