query
Read records, aggregates, or a single record from any ServiceNow table. Use encoded queries, field selection, pagination, and aggregation with optional grouping and label resolution.
Instructions
Read records, aggregates, or a single record from any ServiceNow table.
Args:
table: ServiceNow table name (e.g. 'incident').
sys_id: When set, fetch a single record by sys_id (other filter args ignored
except fields and display_values).
encoded_query: ServiceNow encoded query string (e.g. 'state=1^priority=2').
Empty = no filter.
fields: Comma-separated field list. Empty returns all (subject to masking).
limit: Max rows (1-max_row_limit). Default 20.
offset: Pagination offset.
order_by: Field name; prefix with '-' for descending (e.g. '-sys_created_on').
display_values: True returns display_value form for reference and choice fields.
aggregate: Comma-separated aggregations: 'count', 'avg:', 'sum:',
'min:', 'max:'. When set, returns aggregate result instead of rows.
group_by: Field to group aggregate results by (aggregate mode only).
resolve_labels: Comma-separated 'field=label' pairs (e.g. 'state=open,priority=high').
Each label is resolved via ChoiceRegistry to its underlying value, then ANDed
into encoded_query as 'field=value'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| sys_id | No | ||
| encoded_query | No | ||
| fields | No | ||
| limit | No | ||
| offset | No | ||
| order_by | No | ||
| display_values | No | ||
| aggregate | No | ||
| group_by | No | ||
| resolve_labels | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |