Count matching records
servicenow_count_recordsCount records in a ServiceNow table matching a query, returning only the count without transferring data. Efficiently answers 'how many' questions with minimal overhead.
Instructions
Count records matching a query without transferring any of them. One request, a few bytes, and no context cost regardless of the number. Prefer this over querying with a large limit whenever the question is 'how many'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | A ServiceNow encoded query. This is NOT SQL: conditions are joined by '^' for AND and '^OR' for OR, with no spaces around operators, and there is no WHERE or SELECT. Example: 'active=true^priority=1^ORDERBYDESCsys_created_on'. Call servicenow_query_syntax for the full operator list. Omit to match every record. A query that names a field which does not exist returns zero records rather than an error, so verify field names with servicenow_describe_table when a result is unexpectedly empty. | |
| table | Yes | System name of the table, not its UI label: 'sys_user' rather than 'User', 'incident' rather than 'Incidents'. Use servicenow_list_tables to find it. |