GlideDynamicAttributeStore - Global

  • Release version: Australia
  • Updated March 12, 2026
  • 10 minutes to read
  • Use the GlideDynamicAttributeStore API to create objects for working with dynamic attributes independently of a table or field.

    This API provides methods that enable you to get and set dynamic schema attributes in a GlideDynamicAttributeStore object. For more details on dynamic attributes, see Dynamic schema.

    To use this API to create dynamic attributes you must have the dynamic_schema_writer role. To read dynamic data using this API you must have the dynamic_schema_reader role.

    There are methods in this API that have the same functionality as dynamic schema methods in the GlideRecord API. Use this API if you want to set the same dynamic attributes on multiple records. Using this API, you can stage a GlideDynamicAttributeStore object with the intended attributes and then copy that object to records using the setDynamicAttributeValue() or setDynamicAttributeValues() method.

    GlideAggregate - Global methods usable with dynamic schema:
    • addAggregate()
    • addHaving()
    • getDynamicAttributeValue()
    • getDynamicAttributeDisplayValue()
    • getValue()
    • groupBy()
    • orderBy()
    • orderByAggregate()
    GlideRecord - Global methods usable with dynamic schema:
    • addQuery()
    • getDisplayValue()
    • getDynamicAttribute()
    • getDynamicAttributeDisplayValue()
    • getDynamicAttributeValue()
    • getValue()
    • orderBy()
    • orderByDesc()
    • setDisplayValue()
    • setDynamicAttributeDisplayValue()
    • setDynamicAttributeValue()
    • setDynamicAttributeValues()
    • setValue()

    GlideDynamicAttributeStore - clear()

    Clears all attributes and their values from the GlideDynamicAttributeStore object.

    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    None

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Toyota");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",true);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg",24.5234);
    das.setDynamicAttributeValue("total_miles",5324);    
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('das: ' + das.getDisplayValue());
    das.clear();
    gs.info('das: ' + das.getDisplayValue());

    Output:

    *** Script: das: {
      "avg_mpg" : "24.5234",
      "color" : "blue",
      "cost" : "12000.5",
      "date_purchased" : "2024-04-19 08:29:52",
      "luxury" : "true",
      "make" : "Toyota",
      "model" : "CRV",
      "total_miles" : "5324"
    }
    *** Script: das: null

    GlideDynamicAttributeStore - getDisplayValue()

    Returns the JSON map representation of the values stored in the current GlideDynamicAttributeStore object.

    This method returns:
    • Boolean values as "true" and "false" instead of 1 and 0.
    • Date/time values in the user’s locale instead of UTC.
    Table 3. Parameters
    Name Type Description
    None
    Table 4. Returns
    Type Description
    String Human-readable JSON map of the values stored in the GlideDynamicAttributeStore object. The contents of this string depends on your dynamic schema definition.

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Honda");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",false);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('Value returned by getValue(): ' + das.getValue());
    gs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());

    Output:

    *** Script: Value returned by getValue(): {"total_miles":5324,"color":"blue","model":"CRV","cost":12000.5,"luxury":1,"avg_mpg":24.5234,"make":"Toyota","date_purchased":"2024-04-19 15:33:23"}
    *** Script: Value returned by getDisplayValue(): {
      "avg_mpg" : "24.5234",
      "color" : "blue",
      "cost" : "12000.5",
      "date_purchased" : "2024-04-19 08:33:23",
      "luxury" : "false",
      "make" : "Honda",
      "model" : "CRV",
      "total_miles" : "5324"
    }

    GlideDynamicAttributeStore - getDynamicAttribute(String attributePath)

    Returns dynamic attribute object located at a specified dynamic attribute path.

    Table 5. Parameters
    Name Type Description
    attributePath String Attribute path to use to locate the associated dynamic schema attribute.

    Format: "attr_name"

    attr_name: Name of the dynamic attribute.

    Table: In the attribute field of the Dynamic Attribute [dynamic_attribute] table.

    Table 6. Returns
    Type Description
    IDynamicAttribute Object containing dynamic attributes.

    The following code example shows how to call this method.

    //Gets all the values of the make attribute from the u_inc_dynamic_schema dynamic attribute store column on the incident table
    var gr_Inc = new GlideRecord('incident');
    gr_Inc.query();
    while(gr_Inc.next()) {
        var attr = gr.getDynamicAttribute('inc_dynamic_schema->make');
        gs.info(attr.getValue());
    }
    
    //You can also use if(gr_Inc.next()) if you don't want all the values
    var gr_Inc = new GlideRecord('incident');
    gr_Inc.query();
    if(gr_Inc.next()) {
        var attr = gr_Inc.getDynamicAttribute('inc_dynamic_schema->make');
        gs.info(attr.getValue());
    }

    GlideDynamicAttributeStore - getDynamicAttributes()

    Returns the set of dynamic attribute definitions present in the store.

    Table 7. Parameters
    Name Type Description
    None
    Table 8. Returns
    Type Description
    Array Array containing all transient and non-transient dynamic attributes present in the store.
    • Dynamic attributes are defined in the Dynamic Attribute [dynamic_attribute] table with a data type and a sys_id. See GlideDynamicAttribute.
    • Transient dynamic attributes are dynamic attributes that have been added to a DynamicAttributeStore field without a definition in the Dynamic Attribute [dynamic_attribute] table. Transient dynamic attributes are handled as strings and have no sys_id.

    The following example shows how to retrieve transient and non-transient dynamic attributes.

    var used_car = new GlideDynamicAttributeStore('u_product/u_car_inventory');
    used_car.setDynamicAttributeValue('mfg_year', 2014);       // transient (adding here)
    used_car.setDynamicAttributeValue('u_total_miles', 53246); // defined in dynamic_attribute table
    
    var attributes = used_car.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 + "].getNamespaceName()  = " + attr.getNamespaceName());
        gs.info("[" + i + "].getNamespacedName() = " + attr.getNamespacedName());
        gs.info("[" + i + "].isTransient()       = " + attr.isTransient());
        gs.info("[" + i + "].getType()           = " + attr.getType());
    }

    Output:

    *** Script: mfg_year,u_total_miles
    *** Script: 
    *** Script: [0].getPath()           = mfg_year
    *** Script: [0].getName()           = mfg_year
    *** Script: [0].getNamespaceName()  = u_product/u_car_inventory
    *** Script: [0].getNamespacedName() = u_product/u_car_inventory/mfg_year
    *** Script: [0].isTransient()       = true
    *** Script: [0].getType()           = string
    *** Script: 
    *** Script: [1].getPath()           = u_total_miles
    *** Script: [1].getName()           = u_total_miles
    *** Script: [1].getNamespaceName()  = u_product/u_car_inventory
    *** Script: [1].getNamespacedName() = u_product/u_car_inventory/u_total_miles
    *** Script: [1].isTransient()       = false
    *** Script: [1].getType()           = integer

    GlideDynamicAttributeStore - getDynamicAttributeValue(String attrPath)

    Returns the value of the specified attribute within the dynamic attribute store element.

    Table 9. Parameters
    Name Type Description
    attrPath String Attribute path to use to locate the associated dynamic schema attribute.

    Format: "attr_name"

    attr_name: Name of the dynamic attribute.

    Table: In the attribute field of the Dynamic Attribute [dynamic_attribute] table.

    Table 10. Returns
    Type Description
    Object Value of the dynamic schema attribute referenced by the passed group/attribute path.

    If the attributePath parameter contains invalid information, returns a null.

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Toyota");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",true);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);
    das.setDynamicAttributeValue("date_purchased", new GlideDateTime());
    gs.info('Value returned by getDynamicAttributeValue(): ' + das.getDynamicAttributeValue("color"));
    gs.info('Value returned by getDynamicAttributeValue(): ' + das.getDynamicAttributeValue("luxury"));
    

    Output:

    *** Script: Value returned by getDynamicAttributeValue(): blue
    *** Script: Value returned by getDynamicAttributeValue(): 1

    GlideDynamicAttributeStore - getDynamicNamespace()

    Returns the dynamic namespace.

    Table 11. Parameters
    Name Type Description
    None
    Table 12. Returns
    Type Description
    Object Namespace object.

    The following example shows how to create a store using a dynamic namespace, and retrieve the name of the namespace.

    gs.info("car_inventory = new GlideDynamicAttributeStore('u_product/u_car_inventory')");
    var car_inventory = new GlideDynamicAttributeStore("u_product/u_car_inventory");
    gs.info("car_inventory.getDynamicNamespace() : " + car_inventory.getDynamicNamespace());
    var ns1 = car_inventory.getDynamicNamespace();

    Output:

    *** Script: new_cars = new GlideDynamicAttributeStore('u_product/u_car_inventory')
    *** Script: new_cars.getDynamicNamespace() : u_product/u_car_inventory

    GlideDynamicAttributeStore - getValue()

    Returns the compact string representation of the contents of the current GlideDynamicAttributeStore object.

    This method returns:
    • Boolean values as 1 and 0 instead of "true" and "false".
    • Date/time values in UTC instead of the user’s locale.
    Table 13. Parameters
    Name Type Description
    None
    Table 14. Returns
    Type Description
    String Compact string representation of the values stored in the GlideDynamicAttributeStore object. The contents of this string depends on your dynamic schema definition.

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Honda");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",false);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('Value returned by getValue(): ' + das.getValue());
    gs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());

    Output:

    *** Script: Value returned by getValue(): {"total_miles":5324,"color":"blue","model":"CRV","cost":12000.5,"luxury":1,"avg_mpg":24.5234,"make":"Toyota","date_purchased":"2024-04-19 15:33:23"}
    *** Script: Value returned by getDisplayValue(): {
      "avg_mpg" : "24.5234",
      "color" : "blue",
      "cost" : "12000.5",
      "date_purchased" : "2024-04-19 08:33:23",
      "luxury" : "false",
      "make" : "Honda",
      "model" : "CRV",
      "total_miles" : "5324"
    }

    GlideDynamicAttributeStore - setDisplayValue(Object value)

    Clears the current GlideDynamicAttributeStore object and then stores the passed JSON map in the GlideDynamicAttributeStore object.

    This method is functionally the same as GlideDynamicAttributeStore - setValue(Object value), except that it assumes that all date values are provided in the user's locale.

    Table 15. Parameters
    Name Type Description
    value Object Value to set in the current dynamic attribute store object.
    The passed value must be of one of the following data types:
    • Boolean (True/False)
    • Decimal
    • Floating Point Number
    • GlideDate
    • GlideDateTime
    • Integer
    • String
    Table 16. Returns
    Type Description
    None

    The following example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Honda");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",false);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);    
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('das: ' + das.getDisplayValue());
    das.setDisplayValue('{"luxury":false}');
    gs.info('das: ' + das.getDisplayValue());

    Output:

    *** Script: das: {
      "avg_mpg" : "24.5",
      "color" : "blue",
      "cost" : "12000.0",
      "date_purchased" : "2024-04-19 14:16:49",
      "luxury" : "false",
      "make" : "Honda",
      "model" : "CRV",
      "total_miles" : "5324.0"
    }
    *** Script: das: {
      "luxury" : "false"
    }

    GlideDynamicAttributeStore - setDynamicAttributeDisplayValue(String attrPath, Object value)

    Sets the value of the dynamic attribute located at a specified path within a dynamic attribute store element.

    This method works the same as the GlideDynamicAttributeStore - setDynamicAttributeValue(String attrPath, Object value) method except in its handling of Boolean and date/time values. This method assumes that all date/time values are provided in the user's locale.

    Table 17. Parameters
    Name Type Description
    attrPath String Attribute path to use to locate the associated dynamic schema attribute.

    Format: "attr_name"

    attr_name: Name of the dynamic attribute.

    Table: In the attribute field of the Dynamic Attribute [dynamic_attribute] table.

    value Object Value to set in the specified attribute.
    Note:
    For dynamic attributes, only the following data types are supported:
    • Boolean (True/False)
    • Decimal
    • Floating Point Number
    • GlideDate
    • GlideDateTime
    • Integer
    • String
    Table 18. Returns
    Type Description
    Object Updated GlideDynamicAttributeStore object.

    If the attrPath parameter isn't valid, the method throws an IllegalArgumentException.

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeDisplayValue("color","blue");
    das.setDynamicAttributeDisplayValue("make","Honda");
    das.setDynamicAttributeDisplayValue("model","CRV");
    das.setDynamicAttributeDisplayValue("luxury","false");
    das.setDynamicAttributeDisplayValue("cost",12000.5);
    das.setDynamicAttributeDisplayValue("avg_mpg", 24.5234);
    das.setDynamicAttributeDisplayValue("total_miles", 5324);    
    das.setDynamicAttributeDisplayValue("date_purchased",new GlideDateTime());
    gs.info('das: ' + das.getDisplayValue());
    das.setDisplayValue('{"luxury":"false"}');
    gs.info('das: ' + das.getDisplayValue());

    Output:

    *** Script: das: {
      "avg_mpg" : "24.5234",
      "color" : "blue",
      "cost" : "12000.5",
      "date_purchased" : "2024-04-19 10:40:45",
      "luxury" : "false",
      "make" : "Honda",
      "model" : "CRV",
      "total_miles" : "5324"
    }
    *** Script: das: {
      "luxury" : "false"
    }

    GlideDynamicAttributeStore - setDynamicAttributeValue(String attrPath, Object value)

    Sets the dynamic attribute referenced by a specified attribute path to a specified value.

    Table 19. Parameters
    Name Type Description
    attrPath String Attribute path to use to locate the associated dynamic schema attribute.

    Format: "attr_name"

    attr_name: Name of the dynamic attribute.

    Table: In the attribute field of the Dynamic Attribute [dynamic_attribute] table.

    value Object Value to set in the specified attribute.
    Note:
    For dynamic attributes, only the following data types are supported:
    • Boolean (True/False)
    • Decimal
    • Floating Point Number
    • GlideDate
    • GlideDateTime
    • Integer
    • String
    Table 20. Returns
    Type Description
    Object Updated GlideDynamicAttributeStore object.

    If the attrPath parameter isn't valid, the method throws an IllegalArgumentException.

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Honda");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",false);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('Value returned by getValue(): ' + das.getValue());
    gs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());

    Output:

    *** Script: Value returned by getValue(): {"total_miles":5324,"color":"blue","model":"CRV","cost":12000.5,"luxury":1,"avg_mpg":24.5234,"make":"Toyota","date_purchased":"2024-04-19 15:33:23"}
    *** Script: Value returned by getDisplayValue(): {
      "avg_mpg" : "24.5234",
      "color" : "blue",
      "cost" : "12000.5",
      "date_purchased" : "2024-04-19 08:33:23",
      "luxury" : "false",
      "make" : "Honda",
      "model" : "CRV",
      "total_miles" : "5324"
    }

    GlideDynamicAttributeStore - setDynamicAttributeValues(Object value)

    Sets the internal JSON storage for the field to the String representation of the passed value. If the passed value is another instance of a GlideDynamicAttributeStore object, it copies the values from that object to the current object.

    Table 21. Parameters
    Name Type Description
    value Object JSON object to store as the value in the associated GlideRecord. The method ignores any invalid JSON values.
    Table 22. Returns
    Type Description
    Object Updated GlideDynamicAttributeStore object.

    The following example shows how to store attribute/value pairs in a GlideDynamicAttributeStore object and then copy those same values from one object to another.

    var das = new GlideDynamicAttributeStore();
    var otherValues = new GlideDynamicAttributeStore();
    otherValues.setDynamicAttributeValue("position_x", 5);
    otherValues.setDynamicAttributeValue("position_y", 6);
    
    das.setDynamicAttributeValues(otherValues);
    gs.info(das);

    Output:

    {"position_x":"5.0","position_y":"6.0"}

    GlideDynamicAttributeStore - setDynamicNamespace(String namespaceName)

    Sets a dynamic namespace name.

    Table 23. Parameters
    Name Type Description
    namespaceName String Dynamic namespace name.
    Table 24. Returns
    Type Description
    Object Updated GlideDynamicAttributeStore object.

    The following example shows how to sets the name of a default namespace to namespace1.

    gs.info("store1 = new GlideDynamicAttributeStore()");
    var store1 = new GlideDynamicAttributeStore();
    gs.info("store1.getDynamicNamespace() : " + store1.getDynamicNamespace());
    gs.info("store1.setDynamicNamespace('namespace1')");
    store1.setDynamicNamespace('namespace1');
    gs.info("store1.getDynamicNamespace() : " + store1.getDynamicNamespace());

    Output:

    *** Script: store1 = new GlideDynamicAttributeStore()
    *** Script: store1.getDynamicNamespace() : default
    *** Script: store1.setDynamicNamespace('namespace1')
    *** Script: store1.getDynamicNamespace() : namespace1

    GlideDynamicAttributeStore - setValue(Object value)

    Clears the current GlideDynamicAttributeStore object and then stores the passed JSON map in that GlideDynamicAttributeStore object.

    This method is functionally the same as GlideDynamicAttributeStore - setDisplayValue(Object value) except that it assumes that all date values are in UTC.

    Table 25. Parameters
    Name Type Description
    value Object JSON map object to store in the GlideDynamicAttributeStore object.

    For example: '{"cost":"12500"}'

    This method ignores any invalid JSON values.
    Table 26. Returns
    Type Description
    None

    The following example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Toyota");
    das.setDynamicAttributeValue("model","Rav4");
    das.setDynamicAttributeValue("luxury",false);
    das.setDynamicAttributeValue("cost",12000.5);
    das.setDynamicAttributeValue("avg_mpg", 24.5234);
    das.setDynamicAttributeValue("total_miles", 5324);    
    das.setDynamicAttributeValue("date_purchased", new GlideDateTime());
    gs.info('das: ' + das.getValue());
    das.setValue('{"luxury":false}');
    gs.info('das: ' + das.getValue());

    Output:

    *** Script: das: {"total_miles":5324,"color":"blue","model":"Rav4","cost":12000.5,"luxury":false,"avg_mpg":24.5234,"make":"Toyota","date_purchased":"2024-04-19 17:28:47"}
    *** Script: das: {"luxury":false}

    GlideDynamicAttributeStore - toString()

    Returns the content of the GlideDynamicAttributeStore object as a string.

    Table 27. Parameters
    Name Type Description
    None
    Table 28. Returns
    Type Description
    String GlideDynamicAttribute object as a string.

    For example: '{"attr2":"true","attr1":"42.0"}'

    The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("color","blue");
    das.setDynamicAttributeValue("make","Toyota");
    das.setDynamicAttributeValue("model","CRV");
    das.setDynamicAttributeValue("luxury",true);
    das.setDynamicAttributeValue("cost",12000);
    das.setDynamicAttributeValue("avg_mpg",24.5);
    das.setDynamicAttributeValue("total_miles",5324);    
    das.setDynamicAttributeValue("date_purchased",new GlideDateTime());
    gs.info('das: ' + das.toString());

    Output:

    *** Script: das: {"cost":"12000.0","color":"blue","avg_mpg":"24.5","date_purchased":"2024-04-19 14:05:00","luxury":"true","model":"CRV","make":"Toyota","total_miles":"5324.123"}