---
sourceDocument: オーストラリアのモバイル構成とナビゲーション
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/mobile

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリアのモバイル構成とナビゲーション

ft:clusterId :

    - mobile

bundleId :

    - mobile

workflow :

    - Development, Data and Analytics


---

# コメントタイプのスクリプトコードと入力アクションの更新

# コメントタイプのスクリプトコードと入力アクションの更新 {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：2分

次のスクリプトを使用して、入力フォームに入力されたユーザーコメントの保存先を決定します。スクリプトは、コメントの削除、更新、新しいテキストの挿入、および変更のタイムスタンプの追跡も記録します。
このコードは、特定の入力に対するパラメーターアクションを処理する関数 WriteBackAction を定義します。<var class="keyword varname">input1</var> のパラメーターアクションを取得し、それらを反復処理してコメントを処理します。コメントが削除済みとしてマークされている場合、アドミニストレーターはコメントの削除を処理するロジックを設定できます。コメントが削除済みとしてマークされていない場合は、コメント値と最後に更新されたタイムスタンプを取得し、特定のレコードの結果テーブルのコメントを追加または更新します。  

    (function WriteBackAction(parm_input, parm_variable, actionResult, additionalData) { 
    var additionalInputDataMap = additionalData.getAdditionalInputDataMap();
    var paramActions = additionalInputDataMap['input1'].getParameterActions(); // input1 stands for the input's name. Could be any input type
    for (i = 0; i < paramActions.length; i++) {
    var currentAction = paramActions[i];
    // Handle Add/Remove/Update Comment 
    if (currentAction.getType() === 'comment') {
    var hasDeleted = currentAction.hasDeleted(); // Checks if the user deleted the comment in the input form's UI
    if (hasDeleted && hasDeleted == true) {
    // Handle delete logic here, for example set the field where the comment is set to an empty string
    } 
    else 
    {
      var commentValue = currentAction.getCommentValue();
                  var commentLastUpdatedTimeStamp = currentAction.getLastUpdatedTimestamp();

    // handle here add/update comment to the result table for the specific record 
    }
    }
    }


