The get command queries records using an encoded query string or fetches a single record by sys_id. Results are printed as formatted JSON. Use --fields to limit output columns and --limit to control result count.
get
Fetch records from any ServiceNow table.
sn get <table> <query|sys_id> [--fields f1,f2] [--limit N] Fetch records from a table.
Arguments
| Name | Required | Description |
|---|---|---|
| table | Yes | The table to query. |
| query|sys_id | Yes | Encoded query string or 32-char sys_id. |
Flags
| Flag | Default | Description |
|---|---|---|
| --fields f1,f2 | — | Comma-separated list of fields to return. |
| --limit N | 10 | Maximum records to return. |
Examples
sn get sys_script_include "name=TestUtils"[
{
"sys_id": "365fc4b3...",
"name": "TestUtils",
"api_name": "global.TestUtils",
"active": "true"
}
]
sn get incident "active=true" --fields number,short_description --limit 3