Connect your AI agent to ServiceNow — query, create, update, and manage records across any table using the Table API and Stats API. Full CRUD operations, aggregate analytics (COUNT/AVG/MIN/MAX/SUM), schema introspection, and attachment management. Purpose-built for ITSM, ITOM, and CMDB workflows including incidents, changes, problems, configuration items, knowledge articles, and more.
INLINECODE6 — Sort field (prefix with - for descending)
INLINECODE8 — Display values mode
Examples:
CODEBLOCK2
snget — Get a single record by sysid
CODEBLOCK3
Options:
- --fields "<field1,field2>" — Fields to return
INLINECODE10 — Display values mode
Example:
CODEBLOCK4
sn_create — Create a record
CODEBLOCK5
Example:
CODEBLOCK6
sn_update — Update a record
CODEBLOCK7
Example:
CODEBLOCK8
sn_delete — Delete a record
CODEBLOCK9
The --confirm flag is required to prevent accidental deletions.
sn_aggregate — Aggregate queries
CODEBLOCK10
Types: COUNT, AVG, MIN, MAX, INLINECODE16
Options:
- --type <TYPE> — Aggregation type (required)
INLINECODE18 — Filter records
INLINECODE19 — Field to aggregate on (required for AVG/MIN/MAX/SUM)
INLINECODE20 — Group results by field
INLINECODE21 — Display values mode
Examples:
CODEBLOCK11
sn_schema — Get table schema
CODEBLOCK12
Returns field names, types, max lengths, mandatory flags, reference targets, and choice values.
Use --fields-only for a compact field list.
sn_batch — Bulk update or delete records
CODEBLOCK13
Performs bulk update or delete operations on all records matching a query. Runs in dry-run mode by default — shows how many records match without making changes. Pass --confirm to execute.
Options:
- --query "<encoded_query>" — Filter records to operate on (required)
INLINECODE25 — Operation to perform (required)
INLINECODE26 — JSON fields to set on each record (required for update)
INLINECODE27 — Max records to affect per run (default 200, safety cap at 10000)
INLINECODE28 — Show match count only, no changes (default behavior)
INLINECODE29 — Actually execute the operation (disables dry-run)
Examples:
CODEBLOCK14
Output (JSON summary):
CODEBLOCK15
sn_health — Instance health check
CODEBLOCK16
Checks ServiceNow instance health across multiple dimensions. Default is --check all which runs every check.
Checks:
- version — Instance build version, date, and tag from sysproperties
nodes — Cluster node status (online/offline) from sysclusterstate
jobs — Stuck/overdue scheduled jobs from systrigger (state=ready, nextaction > 30 min past)
semaphores — Active semaphores (potential locks) from syssemaphore
stats — Quick dashboard: active incidents, open P1s, active changes, open problems