generic-crud-operations
Master generic table operations for querying, creating, updating, and reading records in any ServiceNow table
Happy Technologies LLC · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add Happy-Technologies-LLC/happy-platform-skills --skill generic-crud-operations技能说明
name: generic-crud-operations version: 1.0.0 description: Master generic table operations for querying, creating, updating, and reading records in any ServiceNow table author: Happy Technologies LLC tags: [admin, crud, tables, api, basics] platforms: [claude-code, claude-desktop, chatgpt, cursor, any] tools: mcp: [SN-Query-Table, SN-Create-Record, SN-Get-Record, SN-Update-Record, SN-Get-Table-Schema] rest: ["/api/now/table/{table}"] native: [Bash] complexity: beginner estimated_time: 10-15 minutes
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: incident
Response 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: true
Response 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: 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
Step 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_to
Step 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-31
Step 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: 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>
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 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
Common 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 |