---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideRecord 変数を null に設定

# GlideRecord 変数を null に設定 {#ariaid-title1}

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

GlideRecord 変数 (current を含む) は、データベース内での初期状態は null です。これらを空の文字列、スペース、または JavaScript null 値に戻しても、この初期状態には戻りません。
注:  
この機能を使用するには、JavaScript のナレッジが必要です。 初期状態に設定を戻すには、値を「NULL」に設定します。update() 関数は、現在のオブジェクトではなくレコードで実行されることに注意してください。オブジェクトは、レコードから再度呼び出されるまで初期値を表示します。  
注:  
ここで説明する機能には、admin ロールが必要です。

## 例 1 {#r_SettingAGlideRecordVariableToNull__section_rxv_wzv_msb}

    var grIncident = new GlideRecord('incident');
    grIncident.addNotNullQuery("assigned_to");
    grIncident.query();
    if (grIncident.next()) {
      gs.log("The incident record that is going to be updated is " + grIncident.number);
      gs.log("Previous Value of 'Assigned To' field: " + grIncident.assigned_to);
      grIncident.assigned_to = "NULL";
      grIncident.update();
      gs.log("Current Value of 'Assigned To' field: " + grIncident.assigned_to);
    }

## 例 2 (ビジネスルール) {#r_SettingAGlideRecordVariableToNull__section_sxv_wzv_msb}

    current.u_affected_value = 'NULL';
    current.update();


