skills/admin/generic-crud-operations/SKILL.md
Master generic table operations for querying, creating, updating, and reading records in any ServiceNow table
npx skillsauth add happy-technologies-llc/happy-servicenow-skills generic-crud-operationsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ServiceNow MCP provides generic tools that work on ANY table in the platform. This skill teaches you how to perform Create, Read, Update, and Delete (CRUD) operations across 160+ ServiceNow tables without needing specialized tools for each.
Before working with any table, understand its structure using schema discovery.
Get Basic Schema:
Tool: SN-Get-Table-Schema
Parameters:
table_name: incident
Response includes:
Get Extended Schema:
Tool: SN-Discover-Table-Schema
Parameters:
table_name: incident
include_relationships: true
Response includes:
Query any table using filters, field selection, and pagination.
Basic Query:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true
limit: 10
Query with Field Selection:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true^priority=1
fields: sys_id,number,short_description,state,assigned_to
limit: 20
Query with Pagination:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true
fields: number,short_description
limit: 50
offset: 100
Query with Ordering:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true^ORDERBYDESCpriority
fields: number,short_description,priority
limit: 25
Retrieve a specific record by sys_id.
Get Record:
Tool: SN-Get-Record
Parameters:
table_name: incident
sys_id: abc123def456...
Get Record with Field Selection:
Tool: SN-Get-Record
Parameters:
table_name: incident
sys_id: abc123def456...
fields: number,short_description,state,priority,assigned_to
Create new records in any table with proper field values.
Create Record:
Tool: SN-Create-Record
Parameters:
table_name: incident
data:
short_description: Network connectivity issue in Building A
description: Users in Building A floor 3 unable to access network resources
category: network
subcategory: connectivity
impact: 2
urgency: 2
caller_id: <user_sys_id>
assignment_group: <group_sys_id>
Response Returns:
sys_id of the created recordnumber (if auto-generated)Create Record with Reference Fields:
Tool: SN-Create-Record
Parameters:
table_name: task
data:
short_description: Follow up with customer
parent: <parent_task_sys_id>
assigned_to: <user_sys_id>
assignment_group: <group_sys_id>
due_date: 2024-12-31
Update existing records by sys_id.
Update Single Field:
Tool: SN-Update-Record
Parameters:
table_name: incident
sys_id: abc123def456...
data:
state: 2
Update Multiple Fields:
Tool: SN-Update-Record
Parameters:
table_name: incident
sys_id: abc123def456...
data:
state: 2
assigned_to: <user_sys_id>
work_notes: Investigation in progress
priority: 2
Update Reference Fields:
Tool: SN-Update-Record
Parameters:
table_name: incident
sys_id: abc123def456...
data:
assignment_group: <new_group_sys_id>
assigned_to: <new_user_sys_id>
Perform multiple operations efficiently.
Batch Create:
Tool: SN-Batch-Create
Parameters:
records:
- table: sys_user_group
data:
name: Network Support L1
description: Level 1 network support
- table: sys_user_group
data:
name: Network Support L2
description: Level 2 network support
- table: sys_user_group
data:
name: Network Support L3
description: Level 3 network support
Batch Update:
Tool: SN-Batch-Update
Parameters:
updates:
- table: incident
sys_id: abc123...
data:
state: 6
resolution_code: Solved
- table: incident
sys_id: def456...
data:
state: 6
resolution_code: Solved
- table: incident
sys_id: ghi789...
data:
state: 6
resolution_code: Solved
| Field | Description | Notes |
|-------|-------------|-------|
| sys_id | Unique identifier | 32-character GUID, read-only |
| sys_created_on | Creation timestamp | Read-only |
| sys_created_by | Creator username | Read-only |
| sys_updated_on | Last update timestamp | Read-only |
| sys_updated_by | Last updater username | Read-only |
| sys_mod_count | Modification count | Read-only |
| sys_class_name | Table name | For extended tables |
Reference fields link to records in other tables.
Setting a Reference:
{
"assigned_to": "5137153cc611227c000bbd1bd8cd2007"
}
Getting Display Values:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true
fields: number,assigned_to,assigned_to.name,assigned_to.email
limit: 10
Response includes:
{
"assigned_to": {
"value": "5137153cc611227c000bbd1bd8cd2007",
"display_value": "John Smith"
},
"assigned_to.name": "John Smith",
"assigned_to.email": "[email protected]"
}
Choice fields have predefined values.
Get Available Choices:
Tool: SN-Query-Table
Parameters:
table_name: sys_choice
query: name=incident^element=state
fields: value,label
Common Incident States: | Value | Label | |-------|-------| | 1 | New | | 2 | In Progress | | 3 | On Hold | | 6 | Resolved | | 7 | Closed |
Date Format: YYYY-MM-DD
DateTime Format: YYYY-MM-DD HH:MM:SS
Example:
{
"due_date": "2024-12-31",
"work_start": "2024-12-01 09:00:00"
}
| Tool | Purpose |
|------|---------|
| SN-Query-Table | Query records with filters |
| SN-Get-Record | Get single record by sys_id |
| SN-Create-Record | Create new records |
| SN-Update-Record | Update existing records |
| SN-Get-Table-Schema | Discover table structure |
| SN-Discover-Table-Schema | Extended schema with relationships |
| SN-Batch-Create | Create multiple records |
| SN-Batch-Update | Update multiple records |
| Endpoint | Method | Purpose |
|----------|--------|---------|
| /api/now/table/{table} | GET | Query records |
| /api/now/table/{table}/{sys_id} | GET | Get single record |
| /api/now/table/{table} | POST | Create record |
| /api/now/table/{table}/{sys_id} | PATCH | Update record |
| /api/now/table/{table}/{sys_id} | PUT | Replace record |
| /api/now/table/{table}/{sys_id} | DELETE | Delete record |
REST Query Parameters:
| Parameter | Description |
|-----------|-------------|
| sysparm_query | Encoded query string |
| sysparm_fields | Comma-separated field list |
| sysparm_limit | Maximum records to return |
| sysparm_offset | Records to skip (pagination) |
| sysparm_display_value | Return display values (all, true, false) |
For REST API access without MCP:
# Query records
curl -u "username:password" \
"https://instance.service-now.com/api/now/table/incident?sysparm_query=active=true&sysparm_limit=10"
# Create record
curl -X POST -u "username:password" \
-H "Content-Type: application/json" \
-d '{"short_description":"Test incident"}' \
"https://instance.service-now.com/api/now/table/incident"
# Update record
curl -X PATCH -u "username:password" \
-H "Content-Type: application/json" \
-d '{"state":"2"}' \
"https://instance.service-now.com/api/now/table/incident/abc123..."
SN-Get-Table-Schema before working with unfamiliar tableslimit and offset to page through resultsSymptom: Query returns empty results or get returns 404 Cause: Invalid sys_id, record deleted, or insufficient permissions Solution: Verify sys_id exists and user has read access to the table
Symptom: 403 Forbidden error on create/update Cause: User lacks write permissions to the table or specific fields Solution: Check ACLs and required roles for the table operation
Symptom: Create/update fails with field validation error Cause: Value doesn't match field type or choice list Solution: Check field schema for valid values, especially for choice and reference fields
Symptom: Reference field value not saved Cause: Invalid sys_id or referenced record doesn't exist Solution: Query the reference table to get valid sys_ids
Symptom: Create fails with mandatory field error Cause: Required field not provided in data Solution: Check schema for mandatory fields and include all required values
Tool: SN-Query-Table
Parameters:
table_name: sys_user
query: active=true
fields: sys_id,user_name,name,email,department
limit: 50
Tool: SN-Create-Record
Parameters:
table_name: cmdb_ci_server
data:
name: web-server-01
ip_address: 192.168.1.100
os: Linux Red Hat
cpu_count: 4
ram: 16384
classification: Production
environment: Production
Tool: SN-Batch-Update
Parameters:
updates:
- table: incident
sys_id: inc001...
data:
assignment_group: <network_team_id>
work_notes: Routing to network team per triage
- table: incident
sys_id: inc002...
data:
assignment_group: <network_team_id>
work_notes: Routing to network team per triage
Tool: SN-Query-Table
Parameters:
table_name: incident
query: number=INC0010001
fields: number,short_description,caller_id.name,caller_id.email,caller_id.department.name
# Page 1
Tool: SN-Query-Table
Parameters:
table_name: change_request
query: state=-1
fields: number,short_description,start_date,end_date
limit: 100
offset: 0
# Page 2
Tool: SN-Query-Table
Parameters:
table_name: change_request
query: state=-1
fields: number,short_description,start_date,end_date
limit: 100
offset: 100
itsm/natural-language-queries - Natural language search masteryitsm/quick-reference - ITSM quick reference cardadmin/batch-operations - Advanced batch operationstesting
Manage supplier onboarding, qualification, performance monitoring, and offboarding with auditable lifecycle controls
tools
Identify emerging risks, prioritize intake signals, and route candidates into formal GRC risk assessment workflows
documentation
Screen inbound documents for completeness, policy risk, and routing readiness before extraction or case workflows
testing
Generate concise task summaries with status, timeline, blockers, SLA risk, and recommended next actions