GlideTransientDynamicAttribute - グローバル

  • リリースバージョン: Yokohama
  • 更新日 2025年01月30日
  • 所要時間:16分
  • GlideTransientDynamicAttribute API は、一時的な動的属性メタデータへのアクセスを提供します。

    この API は、DynamicAttributeStore フィールドに追加され、動的属性 [dynamic_attribute] テーブルで定義されていない一時的な動的属性値を取得できるようにするメソッドを提供します。一時的な動的属性はすべて文字列データ型として処理され、sys_idはありません。動的属性の詳細については、「 動的スキーマ」を参照してください。同じメソッドを GlideDynamicAttribute - グローバル API の動的属性にも使用できます。

    この API を使用して動的属性を作成するには、dynamic_schema_writer ロールが必要です。この API を使用して動的データを読み取るには、dynamic_schema_reader ロールが必要です。

    GlideTransientDynamicAttribute - getGroupName()

    一時的な動的属性オブジェクトのグループ名プロパティの値を取得します。

    表 : 1. パラメーター
    名前 タイプ 説明
    なし
    表 : 2. 返される内容
    タイプ 説明
    文字列 一時的な動的属性のグループ名プロパティの値。

    Create a dynamic attribute group」も参照してください。

    次の例では、一時的な動的属性オブジェクトグループ名の値が a として表示されます。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string

    GlideTransientDynamicAttribute - getName()

    一時的な動的属性オブジェクトの name プロパティの値を取得します。

    表 : 3. パラメーター
    名前 タイプ 説明
    なし
    表 : 4. 返される内容
    タイプ 説明
    文字列 一時的な動的属性の名前プロパティの値。

    次の例では、一時的な動的属性オブジェクト名の値が b と表示されます。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string

    GlideTransientDynamicAttribute - getPath()

    一時的な動的属性オブジェクトのパスプロパティの値を取得します。

    表 : 5. パラメーター
    名前 タイプ 説明
    なし
    表 : 6. 返される内容
    タイプ 説明
    文字列 一時的な動的属性のパスの値。

    次の例では、一時的な動的属性オブジェクトパスの値が a->b として表示されます。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string

    GlideTransientDynamicAttribute - getSysId()

    一時的な動的属性オブジェクトのsys_id値 (未定義) を取得します。

    表 : 7. パラメーター
    名前 タイプ 説明
    なし
    表 : 8. 返される内容
    タイプ 説明
    文字列 選択したオブジェクトが一時的な動的属性である場合、結果は未定義です。それ以外の場合は、動的属性sys_id。

    次の例では、一時的な動的属性オブジェクトのsys_idの値が nullとして表示されます。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string

    GlideTransientDynamicAttribute - getType()

    一時的な動的属性オブジェクトの type プロパティの値を取得します。

    表 : 9. パラメーター
    名前 タイプ 説明
    なし
    表 : 10. 返される内容
    タイプ 説明
    文字列 一時的な動的属性のデータタイプの値。一時的な動的属性のデータタイプは常に文字列です。

    次の例では、一時的な動的属性オブジェクトタイプの値が 文字列として表示されます。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string

    GlideTransientDynamicAttribute - isTransient()

    オブジェクトが一時的な動的属性であるかどうかを返します。

    表 : 11. パラメーター
    名前 タイプ 説明
    なし
    表 : 12. 返される内容
    タイプ 説明
    ブール 動的属性が一時的かどうかを示すフラグ。
    有効な値:
    • true:動的属性は一時的です。 動的属性は、データタイプと sys-id を使用して動的属性 [dynamic-attribute] テーブルで定義されます。
    • false:動的属性は一時的ではありません。 一時的な動的属性は、動的属性 [dynamic_attribute] テーブルに定義なしで DynamicAttributeStore フィールドに追加された動的属性です。一時的な動的属性は文字列として処理され、sys_idはありません。
    注:
    動的属性 [dynamic_attribute] テーブルにアクセスするには、 All (すべて) > 動的なスキーマ > 動的属性グループをクリックし、グループを選択して [動的属性 ] タブを選択します。

    次の例では、 isTransient() メソッドは一時オブジェクトに対して true を返します。

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue('a->b', 5);    // transient (adding here)
    das.setDynamicAttributeValue('a->c', 10);   // defined in dynamic_attribute table
    
    var attributes = das.getDynamicAttributes();
    gs.info(attributes);
    
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
    	
        gs.info("");
        gs.info("[" + i + "].getPath()      = " + attr.getPath());
        gs.info("[" + i + "].getName()      = " + attr.getName());
        gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
        gs.info("[" + i + "].getSysId()     = " + attr.getSysId());
        gs.info("[" + i + "].isTransient()  = " + attr.isTransient());
        gs.info("[" + i + "].getType()      = " + attr.getType());
    }

    出力:

    *** Script: a->c,a->b
    *** Script: 
    *** Script: [0].getPath()      = a->c
    *** Script: [0].getName()      = c
    *** Script: [0].getGroupName() = a
    *** Script: [0].getSysId()     = 8bc411a94fc01210b8ddc0e552ce0b3c
    *** Script: [0].isTransient()  = false
    *** Script: [0].getType()      = integer
    *** Script: 
    *** Script: [1].getPath()      = a->b
    *** Script: [1].getName()      = b
    *** Script: [1].getGroupName() = a
    *** Script: [1].getSysId()     = undefined
    *** Script: [1].isTransient()  = true
    *** Script: [1].getType()      = string