generic-crud-operations
Skill41 starsChanged 6 days agoApache-2.0View on GitHub
Master generic table operations for querying, creating, updating, and reading records in any ServiceNow table
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Before working with any table, understand its structure using schema discovery.
- Distinctive: line 60
All base schema information
- Distinctive: line 131
Create new records in any table with proper field values.
- Distinctive: line 152
All created field values
- Distinctive: line 169
Update existing records by sys_id.
- Very specific: line 373
Always Check Schema First: Use SN-Get-Table-Schema before working with unfamiliar tables
- Distinctive: line 377
Handle Errors: Check response for error messages, especially on create/update operations
- Distinctive: line 378
Batch Operations: Use batch tools for multiple records (5-10+ operations) for efficiency
- Distinctive: line 386
Solution: Verify sys_id exists and user has read access to the table
- Distinctive: line 392
Solution: Check ACLs and required roles for the table operation
- Distinctive: line 396
Symptom: Create/update fails with field validation error
- Distinctive: line 398
Solution: Check field schema for valid values, especially for choice and reference fields
- Distinctive: line 408
Symptom: Create fails with mandatory field error
- Distinctive: line 410
Solution: Check schema for mandatory fields and include all required values
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generic CRUD Operations
Overview
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.
- What problem does it solve? Provides a single, consistent approach to table operations
- Who should use this skill? Developers, administrators, and integrators working with ServiceNow data
- What are the expected outcomes? Ability to query, create, update, and retrieve records from any table
Prerequisites
- MCP ServiceNow server configured and running
- Appropriate ServiceNow roles for target tables (varies by table)
- Basic understanding of ServiceNow table structure (sys_id, display values)
Procedure
Step 1: Discover Table Schema
Before working with any table, understand its structure using schema discovery.
Get Basic Schema:
Tool: SN-Get-Table-Schema
Parameters:
table_name: incidentResponse includes:
- Field names and types
- Field lengths and mandatory flags
- Reference table relationships
- Choice values for choice fields
Get Extended Schema:
Tool: SN-Discover-Table-Schema
Parameters:
table_name: incident
include_relationships: trueResponse includes:
- All base schema information
- Parent/child table relationships
- Referenced tables and foreign keys
Step 2: Query Records (Read)
Query any table using filters, field selection, and pagination.
Basic Query:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true
limit: 10Query 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: 20Query with Pagination:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true
fields: number,short_description
limit: 50
offset: 100Query with Ordering:
Tool: SN-Query-Table
Parameters:
table_name: incident
query: active=true^ORDERBYDESCpriority
fields: number,short_description,priority
limit: 25Step 3: Get Single Record (Read)
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_toStep 4: Create Records (Create)
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_idof the created recordnumber(if auto-generated)- All created field values
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-31Step 5: Update Records (Update)
Update existing records by sys_id.
Update Single Field:
Tool: SN-Update-Record
Parameters:
table_name: incident
sys_id: abc123def456...
data:
state: 2Update 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: 2Update 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>Step 6: Batch Operations
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 supportBatch 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: SolvedCommon Field Patterns
System Fields (All Tables)
| 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
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: 10Response includes:
{
"assigned_to": {
"value": "5137153cc611227c000bbd1bd8cd2007",
"display_value": "John Smith"
},
"assigned_to.name": "John Smith",
"assigned_to.email": "john.smith@example.com"
}Choice Fields
Choice fields have predefined values.
Get Available Choices:
Tool: SN-Query-Table
Parameters:
table_name: sys_choice
query: name=incident^element=state
fields: value,labelCommon Incident States:
| Value | Label |
| 1 | New |
| 2 | In Progress |
| 3 | On Hold |
| 6 | Resolved |
| 7 | Closed |
Date/Time Fields
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 Usage
MCP Tools (Claude Code/Desktop)
| 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 |
REST API (ChatGPT/Other)
| 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) |
Native Tools (Claude Code)
Use the MCP tools above as the primary path. Raw REST is a last resort only when an operation is unavailable through MCP. In that case, rely on an organization-approved local credential helper that is already configured outside the conversation. Never ask the user to paste authentication material, embed it in a command, or generate a request containing authentication headers. Preserve the same schema checks, field selection, pagination, ACLs, and explicit instance targeting used by the MCP workflow.
Best Practices
- Always Check Schema First: Use
SN-Get-Table-Schemabefore working with unfamiliar tables - Specify Fields: Include only needed fields to reduce response payload and improve performance
- Use Pagination: For large datasets, use
limitandoffsetto page through results - Validate sys_ids: Reference fields require valid sys_ids from the referenced table
- Handle Errors: Check response for error messages, especially on create/update operations
- Batch Operations: Use batch tools for multiple records (5-10+ operations) for efficiency
Troubleshooting
Record Not Found
Symptom: 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
Permission Denied (403)
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
Invalid Field Value
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
Reference Field Rejected
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
Mandatory Field Missing
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
Examples
Example 1: Query Active Users
Tool: SN-Query-Table
Parameters:
table_name: sys_user
query: active=true
fields: sys_id,user_name,name,email,department
limit: 50Example 2: Create Configuration Item
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: ProductionExample 3: Update Multiple Incidents
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 triageExample 4: Get Record with Dot-Walking
Tool: SN-Query-Table
Parameters:
table_name: incident
query: number=INC0010001
fields: number,short_description,caller_id.name,caller_id.email,caller_id.department.nameExample 5: Paginated Query
# 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: 100Related Skills
itsm/natural-language-queries- Natural language search masteryitsm/quick-reference- ITSM quick reference cardadmin/batch-operations- Advanced batch operations
References
In this repository184 other files it gives its agents.
- happy-platform-skillsSkill
- application-scopeSkill
- batch-operationsSkill
- configuration-validationSkill
- deployment-workflowSkill
- instance-managementSkill
- schema-discoverySkill
- script-executionSkill
- script-syncSkill
- smart-assessmentSkill
- task-analysisSkill
- task-summarizationSkill
- update-set-managementSkill
- user-provisioningSkill
- workflow-creationSkill
- workspace-insightsSkill
- approval-summarizationSkill
- approval-workflowsSkill
- catalog-builder-aiSkill
- catalog-item-generationSkill
- item-creationSkill
- multi-turn-orderingSkill
- request-fulfillmentSkill
- ui-policiesSkill
- variable-managementSkill
- ci-discoverySkill
- cmdb-search-analysisSkill
- data-qualitySkill
- impact-analysisSkill
- relationship-mappingSkill
- service-graph-diagnosisSkill
- activity-responseSkill
- csm-case-summarizationSkill
- chat-recommendationSkill
- email-recommendationSkill
- csm-kb-generationSkill
- resolution-notesSkill
- csm-sentiment-analysisSkill
- csm-sidebar-summarizationSkill
- csm-suggested-stepsSkill
- trending-topicsSkill
- automated-testingSkill
- business-rulesSkill
- client-scriptsSkill
- code-assistSkill
- code-reviewSkill
- data-importSkill
- debugging-techniquesSkill
- fluent-sdkSkill
- glide-api-referenceSkill
- mcp-server-installationSkill
- mcp-serverSkill
- notificationsSkill
- performance-optimizationSkill
- scheduled-jobsSkill
- scripted-rest-apisSkill
- script-includesSkill
- servicenow-docs-mcpSkill
- test-generationSkill
- ui-actionsSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

