mcpField
I
item-creation

item-creation

github.com/happy-technologies-llc開発4141 回インストール2 日前に更新
リポジトリ

item-creation について

ServiceNowのサービスカタログ管理者向けに、カタログアイテムと申請フォームの作成・公開手順を案内するスキルです。分類、フォーム変数、再利用可能な変数セット、価格、フルフィルメント設定を扱い、公開前の確認も含みます。

主な機能

  1. 01カタログアイテムの作成と分類
  2. 02複数タイプのフォーム変数の追加
  3. 03再利用可能な変数セットと選択肢の設定
  4. 04価格とフルフィルメントの設定
  5. 05アイテムの公開と設定確認

活用シーン

  1. 01従業員向けサービスカタログアイテムの作成
  2. 02選択肢を含む申請フォームの構築
  3. 03複数アイテムで共通項目を再利用
  4. 04アイテムの価格と処理フローの設定

MCP 対応

ServiceNowのMCPツールでカタログアイテム、カテゴリ、変数レコードを照会・作成し、設定の更新、アイテムの有効化、結果の確認を行います。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/happy-technologies-llc/happy-platform-skills --skill item-creation

インストール後、Claude Code で/item-creationを入力して読み込まれたか確認します。

詳細

サービスカタログアイテムの作成

概要

このスキルでは、サービスカタログアイテムを作成する一連の手順を扱います。

  • カタログアイテムの構造を理解する
  • 適切に分類してアイテムを作成する
  • 正しいタイプで変数(フォームフィールド)を追加する
  • 再利用できるように変数セットを設定する
  • 価格とフルフィルメントのオプションを設定する
  • アイテムを公開してテストする

使用する場面: 新しいサービスを提供するとき、リクエストフォームを作成するとき、またはカタログアイテムのフルフィルメントを設定するとき。

前提条件

  • ロール: catalog_admin または admin
  • アクセス: sc_cat_item、item_option_new、sc_category テーブル
  • 知識: サービスカタログの構造、変数のタイプ
  • 関連スキル: 高度な変数設定については、catalog/variable-management を完了してください

手順

ステップ 1:カタログアイテムの構造を理解する
sc_catalog (Catalog)
└── sc_category (Category)
    └── sc_cat_item (Catalog Item)
        ├── item_option_new (Variables) - Form fields
        ├── io_set_item (Variable Set M2M) - Reusable variable groups
        ├── sc_cat_item_catalog (Catalog M2M) - Multi-catalog support
        └── workflow/flow (Fulfillment) - Processing logic

主要なテーブル:

テーブル用途
sc_cat_itemカタログアイテムの定義
sc_category整理するためのカテゴリ
item_option_new個別の変数(フォームフィールド)
io_set_item変数セットとアイテムのマッピング
question_choiceカタログ変数の選択肢(sys_choice ではありません!)
ステップ 2:カテゴリを検索または作成する

既存のカテゴリを検索する:

Tool: SN-Query-Table
Parameters:
  table_name: sc_category
  query: active=true
  fields: sys_id,title,parent,sc_catalog,order
  limit: 100

必要に応じて新しいカテゴリを作成する:

Tool: SN-Create-Record
Parameters:
  table_name: sc_category
  data:
    title: "Employee Services"
    sc_catalog: [catalog_sys_id]  # Usually Service Catalog
    parent: [parent_category_sys_id]  # Optional
    description: "Services for employee onboarding and lifecycle"
    icon: "user"
    active: true
    order: 100
ステップ 3:カタログアイテムを作成する

基本的なカタログアイテム:

Tool: SN-Create-Record
Parameters:
  table_name: sc_cat_item
  data:
    name: "New Employee Laptop Request"
    short_description: "Request a laptop for new employee"
    description: |
      Use this form to request a laptop for a new employee.

      Processing time: 3-5 business days

      Please have the following information ready:
      - Employee name and start date
      - Department and manager
      - Required software
    category: [category_sys_id]
    sc_catalogs: [catalog_sys_id]
    workflow: [workflow_sys_id]  # Or use flow_designer_flow
    active: true
    visible_standalone: true
    visible_bundle: true
    visible_guide: true
    order: 100
    meta: "laptop,computer,hardware,new hire"  # Search keywords

高度なアイテム設定:

Tool: SN-Create-Record
Parameters:
  table_name: sc_cat_item
  data:
    name: "Software License Request"
    short_description: "Request software license"
    category: [category_sys_id]
    sc_catalogs: [catalog_sys_id]
    # Pricing
    price: 0
    recurring_price: 99.00
    recurring_frequency: "monthly"
    # Approval
    no_quantity: false
    no_proceed_checkout: false
    # Availability
    start_date: "2026-01-01"
    end_date: ""  # No end date
    availability: "on_desktop"  # desktop, mobile, both
    # SLA
    delivery_time: "3 00:00:00"  # 3 days in GlideDuration format
    # Template
    template: [template_sys_id]  # Pre-fill variables
    active: true
ステップ 4:変数(フォームフィールド)を追加する

変数タイプの一覧:

タイプ値使用例
単一行テキスト16短いテキスト入力(名前、タイトル)
複数行テキスト6長いテキスト(説明、メモ)
選択肢(ラジオボタン)12~5 個の選択肢を一度に表示
選択ボックス(ドロップダウン)56 個以上の選択肢、または長いラベル
参照8ServiceNow レコードへのリンク
はい/いいえ7真偽値の切り替え
チェックボックス7はい/いいえと同じ
日付9日付ピッカー
日付/時刻10日付と時刻のピッカー
メール32メールアドレスの検証
URL26URL の検証
数値スケール21~10 の評価
ルックアップ選択ボックス21フィルタリングされた参照
コンテナー開始19変数を視覚的にグループ化
コンテナー終了20コンテナーグループを終了
ラベル11表示専用テキスト
区切り12視覚的な区切り
マクロ14UI マクロの実行
マスク25パスワード形式の入力
HTML17リッチテキスト/HTML 表示

単一行テキスト変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "employee_name"
    question_text: "Employee Full Name"
    type: 16  # Single Line Text
    order: 100
    mandatory: true
    active: true
    help_text: "Enter the employee's full legal name"
    default_value: ""

選択ボックス(ドロップダウン)変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "laptop_type"
    question_text: "Laptop Type"
    type: 5  # Select Box
    order: 200
    mandatory: true
    active: true
    include_none: false

選択肢(ラジオボタン)変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "warranty"
    question_text: "Warranty Option"
    type: 1  # Choice (Radio)
    order: 300
    mandatory: true
    active: true

参照変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "manager"
    question_text: "Manager"
    type: 8  # Reference
    reference: sys_user
    reference_qual: "active=true^roles!=admin"  # Filter options
    order: 400
    mandatory: true
    active: true

日付変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "start_date"
    question_text: "Employee Start Date"
    type: 9  # Date
    order: 500
    mandatory: true
    active: true

複数行テキスト変数を作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: [catalog_item_sys_id]
    name: "special_requirements"
    question_text: "Special Requirements or Notes"
    type: 6  # Multi-Line Text
    order: 600
    mandatory: false
    active: true
    default_value: ""
ステップ 5:変数に選択肢を追加する

重要: カタログ変数の選択肢には sys_choice ではなく、question_choice テーブルを使用します!

選択ボックスまたは選択肢変数に選択肢を追加する:

Tool: SN-Create-Record
Parameters:
  table_name: question_choice
  data:
    question: [variable_sys_id]  # item_option_new sys_id
    text: "MacBook Pro 14-inch"
    value: "macbook_pro_14"
    order: 100
    inactive: false
Tool: SN-Create-Record
Parameters:
  table_name: question_choice
  data:
    question: [variable_sys_id]
    text: "MacBook Pro 16-inch"
    value: "macbook_pro_16"
    order: 200
    inactive: false
Tool: SN-Create-Record
Parameters:
  table_name: question_choice
  data:
    question: [variable_sys_id]
    text: "Dell XPS 15"
    value: "dell_xps_15"
    order: 300
    inactive: false
ステップ 6:変数セットを設定する(再利用可能なグループ)

変数セットを使うと、共通の変数グループを複数のカタログアイテムで再利用できます。

既存の変数セットを検索する:

Tool: SN-Query-Table
Parameters:
  table_name: item_option_new_set
  query: active=true
  fields: sys_id,title,description
  limit: 50

新しい変数セットを作成する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new_set
  data:
    title: "Standard Location Questions"
    description: "Common location-related variables for hardware requests"
    active: true
    type: "one_to_one"  # or "one_to_many"
    order: 100

変数を変数セットに追加する:

Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    variable_set: [variable_set_sys_id]  # Instead of cat_item
    name: "delivery_location"
    question_text: "Delivery Location"
    type: 16
    order: 100
    mandatory: true
    active: true

変数セットをカタログアイテムに関連付ける:

Tool: SN-Create-Record
Parameters:
  table_name: io_set_item
  data:
    sc_cat_item: [catalog_item_sys_id]
    variable_set: [variable_set_sys_id]
    order: 100
ステップ 7:価格を設定する

一回限りの価格:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    price: 1500.00
    cost: 1200.00  # Internal cost
    recurring_price: 0

継続料金:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    price: 0
    recurring_price: 49.99
    recurring_frequency: "monthly"  # monthly, quarterly, yearly

変数に基づく価格設定: 選択されたオプションに基づいて、ワークフローまたはカタログクライアントスクリプトで価格を設定します。

ステップ 8:フルフィルメントを設定する

フルフィルメントグループを割り当てる:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    fulfillment_group: [group_sys_id]
    group: [group_sys_id]  # Alternative field

ワークフローを割り当てる:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    workflow: [workflow_sys_id]

Flow Designer フローを割り当てる:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    flow_designer_flow: [flow_sys_id]
ステップ 9:公開してテストする

カタログアイテムを有効化する:

Tool: SN-Update-Record
Parameters:
  table_name: sc_cat_item
  sys_id: [catalog_item_sys_id]
  data:
    active: true

アイテムの設定を確認する:

Tool: SN-Query-Table
Parameters:
  table_name: sc_cat_item
  query: sys_id=[catalog_item_sys_id]
  fields: name,short_description,category,active,workflow,price

変数を確認する:

Tool: SN-Query-Table
Parameters:
  table_name: item_option_new
  query: cat_item=[catalog_item_sys_id]
  fields: name,question_text,type,order,mandatory,active
  limit: 50

変数の選択肢を確認する:

Tool: SN-Query-Table
Parameters:
  table_name: question_choice
  query: question.cat_item=[catalog_item_sys_id]
  fields: question.name,text,value,order
  limit: 100

完全な例:新入社員向けノートパソコンのリクエスト

# 1. Create catalog item
Tool: SN-Create-Record
Parameters:
  table_name: sc_cat_item
  data:
    name: "New Employee Laptop Request"
    short_description: "Request a laptop for new employee"
    description: "Complete this form to request laptop provisioning for new hires"
    category: [category_sys_id]
    sc_catalogs: [catalog_sys_id]
    price: 0
    delivery_time: "5 00:00:00"
    active: true
# Result: sys_id = "abc123"

# 2. Create employee name variable
Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: "abc123"
    name: "employee_name"
    question_text: "Employee Name"
    type: 16
    order: 100
    mandatory: true
    active: true

# 3. Create laptop type variable
Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: "abc123"
    name: "laptop_type"
    question_text: "Laptop Type"
    type: 5
    order: 200
    mandatory: true
    active: true
# Result: sys_id = "def456"

# 4. Add choices to laptop type
Tool: SN-Create-Record
Parameters:
  table_name: question_choice
  data:
    question: "def456"
    text: "MacBook Pro 14-inch"
    value: "macbook_14"
    order: 100

Tool: SN-Create-Record
Parameters:
  table_name: question_choice
  data:
    question: "def456"
    text: "Dell XPS 15"
    value: "dell_xps_15"
    order: 200

# 5. Create start date variable
Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: "abc123"
    name: "start_date"
    question_text: "Employee Start Date"
    type: 9
    order: 300
    mandatory: true
    active: true

# 6. Create manager reference
Tool: SN-Create-Record
Parameters:
  table_name: item_option_new
  data:
    cat_item: "abc123"
    name: "reporting_manager"
    question_text: "Reporting Manager"
    type: 8
    reference: sys_user
    reference_qual: "active=true"
    order: 400
    mandatory: true
    active: true

ベストプラクティス

  • 命名規則: 変数名には lowercase_with_underscores を使用します
  • 変数を論理的に並べる: 関連するフィールドをまとめ、必須フィールドを先頭に配置します
  • 変数セットを使用する: 共通のグループ(場所、承認者、日付)を再利用します
  • 公開前にテストする: テストリクエストを作成し、フォームの流れを確認します
  • 項目を説明する: 説明フィールドを使ってユーザーに案内します
  • モバイル向けに最適化する: フォームの設計時にはモバイルユーザーを考慮します
  • 選択肢が6個以上の場合はタイプ5を使用する: 長いリストには選択ボックスのほうが使いやすくなります
  • 選択肢が2~5個の場合はタイプ1を使用する: ラジオボタンなら選択肢をひと目で確認できます

トラブルシューティング

変数がフォームに表示されない

症状: 変数を作成したものの、カタログフォームに表示されない 原因:

  1. 変数が無効になっている
  2. cat_item の参照先が間違っている
  3. UI ポリシーで非表示になっている 解決策:
Tool: SN-Query-Table
Parameters:
  table_name: item_option_new
  query: cat_item=[item_sys_id]^active=true
  fields: name,question_text,active,order
ドロップダウンに選択肢が表示されない

症状: 選択ボックスまたは選択肢変数に選択肢が表示されない 原因: 選択肢が question_choice ではなく sys_choice に作成されている 解決策: カタログ変数には question_choice テーブルを使用します

Tool: SN-Query-Table
Parameters:
  table_name: question_choice
  query: question=[variable_sys_id]
  fields: text,value,order,inactive
参照修飾子が機能しない

症状: 参照変数に、絞り込み後ではなくすべてのレコードが表示される 原因: reference_qual の構文が無効 解決策: エンコードされたクエリの構文が正しいことを確認します

カタログに項目が表示されない

症状: 項目を作成したものの、カタログに表示されない 原因:

  1. 項目が無効になっている
  2. カテゴリが間違っている
  3. カタログとの関連付けがない 解決策: active=true であり、sc_catalogs が設定されていることを確認します

関連スキル

  • catalog/variable-management - 変数の高度な設定
  • catalog/approval-workflows - 承認の設定
  • catalog/request-fulfillment - リクエストの処理
  • admin/workflow-creation - フルフィルメントワークフローの構築

参考資料

コメント