ServiceNow
How to filter ServiceNow incident records
Use the Table API with sysparm_query when a script needs filtered incident records. Use the list condition builder when an operator needs to build and inspect the same filter in the ServiceNow interface.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /api/now/table/incident with sysparm_query
Read an incident table with an encoded sysparm_query, select only needed fields, and page with sysparm_limit and sysparm_offset.
Read source: ServiceNow Table API- Requirements
- A ServiceNow instance and credentials for a user with API and read access to the incident table.
- Limitations
- The default sysparm_limit is 10,000 and applies before access-control evaluation, so a page can include fewer visible records than requested. Use sysparm_offset to paginate.
Example shell
curl --fail --get -H "Authorization: Bearer $SERVICENOW_TOKEN" \
-H "Accept: application/json" \
--data-urlencode "sysparm_query=active=true^priority=1" \
--data-urlencode "sysparm_fields=number,state,priority" \
--data-urlencode "sysparm_limit=100" \
"https://$SERVICENOW_INSTANCE.service-now.com/api/now/table/incident"Interface
List condition builder
Open an incident list, show the filter, add field conditions with AND or OR, and run the filter to inspect matching records.
Read source: ServiceNow create a filter- Requirements
- A ServiceNow user with access to the incident list and permission to view the selected fields.
- Limitations
- Operators depend on the field type. For example, Active supports true, false, or empty values, while Priority supports comparisons.
Example text
ServiceNow → Incidents → show filter → Active is true AND Priority is 1 → Run