---
sourceDocument: Yokohama アプリケーションのビルドまたは変更
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/yokohama/application-development

 Release :

    - yokohama

ft:locale :

    - ja-JP

ft:publication_title :

    - Yokohama アプリケーションのビルドまたは変更

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Creator


---

ビジネスルールからワークフロースクラッチパッドへのアクセス
=============================

ビジネスルールからワークフロースクラッチパッドへのアクセス {#ariaid-title1}
==============================================

* リリースバージョン: Yokohama
* 
* 更新日 2025年01月30日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：1分

カタログアイテムが要求されました。添付されたワークフローには、スクラッチパッドに値を入力するスクリプト実行アクティビティが含まれています。要求アイテムで実行されているビジネスルールから、スクラッチパッドの値を取得または設定します。

前提条件
----

必要なロール：admin。

名前：ビジネスルールからのワークフロースクラッチパッドへのアクセス。

タイプ：ビジネスルール。

テーブル：sc_req_item (要求アイテム)。

説明：カタログアイテムが要求されました。添付されたワークフローには、スクラッチパッドに値を入力するスクリプト実行アクティビティが含まれています。要求アイテムで実行されているビジネスルールから、スクラッチパッドの値を取得または設定します。

パラメーター：適用外。  
スクリプト：

    //the run script activity sets a value in the scratchpad
    workflow.scratchpad.important_msg = "scratch me";
     
    //get the workflow script include helper 
    var workflow = new Workflow();
     
    //get the requested items workflow context 
    //this will get all contexts so you will need to get the proper one if you have multiple workflows for a record 
    var context = workflow.getContexts(current); 
    //make sure we have a valid context 
    if (context.next()) { 
      //get a value from the scratchpad 
      var msg = context.scratchpad.important_msg; 
      //msg now equals "scratch me", that was set in the run script activity
     
      //add or modify a scratchpad value
      context.scratchpad.status = "completed"; 
      //we need to save the context record to save the scratchpad
      context.update(); 
    }


