get-one command fetches the first record matching a query and exits with an error if zero or multiple records are found. Use it when exactly one result is expected.get-one
Fetch a single record by query.
The
sn get-one <table> <query> [--fields f1,f2] Fetch a single record by query.
Arguments
| Name | Required | Description |
|---|---|---|
| table | Yes | The table to query. |
| query | Yes | Encoded query that must match exactly one record. |
Flags
| Flag | Default | Description |
|---|---|---|
| --fields f1,f2 | — | Comma-separated list of fields to return. |
Examples
sn get-one sys_script_include "name=MyHelper"{
"sys_id": "abc123",
"name": "MyHelper",
"api_name": "global.MyHelper",
"active": "true"
}