---
sourceDocument: Xanadu Now Platform の管理
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/platform-administration

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu Now Platform の管理

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# 名前と値のペアのフィールドタイプ

# 名前と値のペアのフィールドタイプ {#ariaid-title1}

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

名前を使用して、スクリプトの名前と値のペアのフィールドに格納されている値にアクセスできます。

## サンプルスクリプト {#name-value-pair-scripting__section_tjh_wtz_lz}

次の例は、名前と値のペアのフィールドにマッピングを追加する方法と、名前を使用して既存の値のクエリを実行する方法を示しています。

    // Script example demonstrating setting and getting values
    var gr = new GlideRecord('u_nv_table');
    gr.initialize();

    gr.nv_field.name1 = "value1"; //add a name-value Pair mapping with the name "name1" and value "value1"
    gr.nv_field.name2 = "value2"; //add another name-value Pair mapping with the name "name2" and value "value2"

    // Access by dot notation
    gs.print("name1 = " + gr.nv_field.name1); // Expected output: name1 = value1

    // Iterate over each property and print name and value
    for(var name in gr.nv_field) {
        gs.print(name + " = " + gr.nv_field[name]);
    }

    gs.print(gr.nv_field); // Expected output: {"name1":"value1","name2":"value2"}


