Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Loading