跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
浏览器与自动化

batch-operations

Efficient bulk operations for mass record creation, updates with relationships, performance optimization, and error handling in batch processing

Happy Technologies LLC · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Happy-Technologies-LLC/happy-platform-skills --skill batch-operations

技能说明


name: batch-operations version: 1.0.0 description: Efficient bulk operations for mass record creation, updates with relationships, performance optimization, and error handling in batch processing author: Happy Technologies LLC tags: [admin, batch, bulk, performance, optimization, mass-update, data-migration] platforms: [claude-code, claude-desktop, chatgpt, cursor, any] tools: mcp: - SN-Batch-Create - SN-Batch-Update - SN-Query-Table - SN-Create-Record - SN-Update-Record - SN-Execute-Background-Script rest: - /api/now/table/{table_name} - /api/now/import/{table_name} native: - Bash - Read complexity: advanced estimated_time: 20-60 minutes

Batch Operations

Overview

This skill covers efficient techniques for bulk operations in ServiceNow:

  • Mass record creation with proper relationships
  • Bulk updates with validation and error handling
  • Performance considerations for large datasets
  • Transaction management and rollback strategies
  • Parallel processing patterns

When to use: When creating or updating many records at once, data migrations, bulk imports, or mass data corrections.

Who should use this: Administrators, developers, and data migration specialists.

Prerequisites

  • Roles: admin or table-specific write permissions
  • Access: Target tables and related reference tables
  • Knowledge: GlideRecord API, table relationships, ServiceNow data model
  • Environment: Test in sub-production first for large operations

Performance Guidelines

Record Volume Recommendations

VolumeMethodEstimated Time
1-10Parallel MCP calls< 5 seconds
10-100SN-Batch-Create/Update5-30 seconds
100-1,000Background script batches1-5 minutes
1,000-10,000Scheduled job with batching10-60 minutes
10,000+Import sets or data pumpHours

MCP Parallel Processing

Tested and Verified: 43+ parallel MCP calls successful in single message.

Parallel MCP calls are preferred for:
- Independent record operations
- Different tables
- No interdependencies
- Maximum throughput

Procedure

Phase 1: Mass Record Creation

Step 1.1: Simple Batch Create

Create multiple records in a single operation.

Using MCP:

Tool: SN-Batch-Create
Parameters:
  records:
    - table_name: incident
      data:
        short_description: "Server down - Web01"
        caller_id: [user_sys_id]
        category: hardware
        priority: 1
    - table_name: incident
      data:
        short_description: "Server down - Web02"
        caller_id: [user_sys_id]
        category: hardware
        priority: 1
    - table_name: incident
      data:
        short_description: "Server down - Web03"
        caller_id: [user_sys_id]
        category: hardware
        priority: 1

Response:

{
  "success": true,
  "created": [
    { "table": "incident", "sys_id": "abc123...", "number": "INC0010001" },
    { "table": "incident", "sys_id": "def456...", "number": "INC0010002" },
    { "table": "incident", "sys_id": "ghi789...", "number": "INC0010003" }
  ],
  "errors": []
}

Step 1.2: Parallel MCP Calls

For maximum throughput, use parallel MCP calls in a single message.

Parallel Incident Creation (10 records):

# Call 1:
Tool: SN-Create-Record
Parameters:
  table_name: incident
  data:
    short_description: "Batch test 1"
    category: inquiry

# Call 2:
Tool: SN-Create-Record
Parameters:
  table_name: incident
  data:
    short_description: "Batch test 2"
    category: inquiry

# Call 3-10: Continue pattern...

All calls execute simultaneously - no waiting between operations.

Step 1.3: Create with Relationships

Create parent and child records maintaining relationships.

Using MCP (Sequential for Dependencies):

# Step 1: Create parent record
Tool: SN-Create-Record
Parameters:
  table_name: change_request
  data:
    short_description: "Server Infrastructure Upgrade"
    category: hardware
    type: standard

# Step 2: Create child tasks (use parent sys_id from step 1)
Tool: SN-Batch-Create
Parameters:
  records:
    - table_name: change_task
      data:
        parent: [change_request_sys_id]
        short_description: "Backup existing configuration"
        change_task_type: planning
        order: 100
    - table_name: change_task
      data:
        parent: [change_request_sys_id]
        short_description: "Install new hardware"
        change_task_type: implementation
        order: 200
    - table_name: change_task
      data:
        parent: [change_request_sys_id]
        short_description: "Verify functionality"
        change_task_type: testing
        order: 300

Step 1.4: Background Script for Complex Creation

For complex logic or very large batches:

Tool: SN-Execute-Background-Script
Parameters:
  script: |
    // Batch creation with relationships
    var projectData = [
      {
        name: 'Project Alpha',
        tasks: [
          { name: 'Task A1', order: 1 },
          { name: 'Task A2', order: 2 },
          { name: 'Task A3', order: 3 }
        ]
      },
      {
        name: 'Project Beta',
        tasks: [
          { name: 'Task B1', order: 1 },
          { name: 'Task B2', order: 2 }
        ]
      }
    ];

    var created = { projects: 0, tasks: 0 };

    projectData.forEach(function(project) {
      // Create project
      var prj = new GlideRecord('pm_project');
      prj.initialize();
      prj.short_description = project.name;
      var prjId = prj.insert();
      created.projects++;

      // Create tasks
      project.tasks.forEach(function(task) {
        var tsk = new GlideRecord('pm_project_task');
        tsk.initialize();
        tsk.parent = prjId;
        tsk.short_description = task.name;
        tsk.order = task.order;
        tsk.insert();
        created.tasks++;
      });

      gs.info('Created project: ' + project.name + ' with ' +
阅读完整来源 ↗