Servicenow
@dougschaefer/servicenowv2026.05.27.1
01README
ServiceNow integration model — OAuth client_credentials authentication with automatic token caching, generic Table API CRUD (query, get, create, update, delete), Aggregate API for data analysis, and a passthrough REST call for endpoints outside the Table API. Foundation for spoke development, administration, and ad-hoc operations against any ServiceNow instance.
02Release Notes
Docs: backtick the model type in module JSDoc (symbols-docs scoring); standardize LICENSE. No functional change.
03Models
@dougschaefer/servicenow-instancev2026.05.27.1servicenow/instance.ts
fn lookup()
Verify OAuth credentials, capture instance metadata (release, scope prefix), and identify the user the token impersonates. Run this first to confirm connectivity.
fn tableQuery(table: string, query?: string, fields?: string)
Query a ServiceNow table with an encoded query string. Returns matching records as resource artifacts. Use sysparm_query syntax (e.g., 'active=true^stateIN1,2^ORDERBYsys_created_on').
| Argument | Type | Description |
|---|---|---|
| table | string | Table name (e.g., 'incident', 'sys_user', 'sys_app') |
| query? | string | Encoded query string (sysparm_query). Empty returns all records up to limit. |
| fields? | string | Comma-separated field list to retrieve (sysparm_fields). Defaults to all fields. |
fn tableGet(table: string, sysId: string, fields?: string)
Fetch a single record from a ServiceNow table by sys_id.
| Argument | Type | Description |
|---|---|---|
| table | string | Table name |
| sysId | string | sys_id of the record |
| fields? | string | Comma-separated field list (sysparm_fields). Defaults to all fields. |
fn tableCreate(table: string, fields: record)
Insert a new record into a ServiceNow table. Pass field values as a JSON object.
| Argument | Type | Description |
|---|---|---|
| table | string | Table name |
| fields | record | Field name → value object for the new record |
fn tableUpdate(table: string, sysId: string, fields: record)
Update fields on an existing ServiceNow record. Uses HTTP PATCH semantics — only provided fields are changed.
| Argument | Type | Description |
|---|---|---|
| table | string | Table name |
| sysId | string | sys_id of the record to update |
| fields | record | Field name → value object with only the fields to change |
fn tableDelete(table: string, sysId: string)
Delete a record from a ServiceNow table by sys_id. Destructive — verify the sys_id with tableGet first.
| Argument | Type | Description |
|---|---|---|
| table | string | Table name |
| sysId | string | sys_id of the record to delete |
fn tableAggregate(table: string, query?: string, count?: boolean, avgFields?: string, sumFields?: string, minFields?: string, maxFields?: string, groupBy?: string)
Aggregate query against a ServiceNow table (count, sum, avg, min, max, group_by). Use this for data analysis without dragging full record sets across the wire.
| Argument | Type | Description |
|---|---|---|
| table | string | Table name |
| query? | string | Encoded query (sysparm_query) to filter records before aggregation |
| count? | boolean | Include record count (sysparm_count) |
| avgFields? | string | Comma-separated numeric fields to average (sysparm_avg_fields) |
| sumFields? | string | Comma-separated numeric fields to sum (sysparm_sum_fields) |
| minFields? | string | Comma-separated numeric fields for minimum (sysparm_min_fields) |
| maxFields? | string | Comma-separated numeric fields for maximum (sysparm_max_fields) |
| groupBy? | string | Comma-separated fields to group by (sysparm_group_by) |
fn restCall(path: string, body?: unknown, params?: record)
Generic REST call to any path on the ServiceNow instance. Use for Scripted REST APIs, Import APIs, application-specific endpoints, or anything outside the Table API. The OAuth token is applied automatically.
| Argument | Type | Description |
|---|---|---|
| path | string | URL path on the instance (e.g., '/api/sn_chg_rest/change' or '/api/x_amsoe_app/widget') |
| body? | unknown | Request body for POST/PUT/PATCH (object will be JSON-serialized) |
| params? | record | Query string parameters |
Resources
instance-info(infinite)— ServiceNow instance metadata snapshot — release, build, scope prefix, and the user identity the OAuth token impersonates
record(infinite)— A single record from a ServiceNow table — full field set as returned by the Table API, tagged with table name and sys_id
aggregate(infinite)— Result of a ServiceNow Aggregate API query — count/avg/sum/min/max/group_by output
rest-response(infinite)— Response body from a generic ServiceNow REST call — for endpoints outside the Table API (Scripted REST APIs, Import APIs, custom application endpoints)
04Previous Versions
2026.05.05.3May 13, 2026
Initial publish — ServiceNow Table API CRUD integration with OAuth client_credentials auth.
05Stats
A
100 / 100
Downloads
4
Archive size
15.1 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
06Platforms
07Labels