Aggregate Records
aggregate_recordsAggregate ServiceNow records using COUNT, SUM, AVG, MIN, MAX with filters and GROUP BY via the Stats API.
Instructions
Aggregate records using COUNT, AVG, MIN, MAX, SUM with optional GROUP BY via the Stats API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Include record count in results | |
| query | No | Encoded query string to filter records before aggregation | |
| having | No | Post-aggregation filter (e.g., 'COUNT>5') | |
| group_by | No | Comma-separated fields to group results by (e.g., 'priority,state') | |
| avg_fields | No | Comma-separated fields to average (e.g., 'reassignment_count,reopen_count') | |
| max_fields | No | Comma-separated fields to find maximum values | |
| min_fields | No | Comma-separated fields to find minimum values | |
| sum_fields | No | Comma-separated fields to sum | |
| table_name | Yes | The ServiceNow table name (e.g., 'incident', 'cmdb_ci') |