---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideDynamicAttributeStore - Global

# GlideDynamicAttributeStore - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 8 minutes to read

The GlideDynamicAttributeStore API provides access to a new built-in dynamic attribute store data type, similar to other data types such as string, date, or date/time.

This API provides methods that enable you to get and set dynamic schema attributes within a GlideDynamicAttribute object. These dynamic attributes enable each row in a table to contain different fields. The fields on which this data
type is applied are shown as `dynamic_attribute_store` within the column data type description of the table. For more details on dynamic attributes, see [Dynamic schema](https://www.servicenow.com/docs/access?context=dynamic-schema&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).

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.  
The following screenshot shows the dynamic attribute group and associated dynamic attributes that are used in the code examples for this API. The defined attributes provide an example of each of the data types that the dynamic schema implementation supports.  

There are methods in this API that have the same functionality as dynamic schema methods in the [GlideRecord](https://servicenow-prod.fluidtopics.net/nRmUiaC7a08cr2N5iZGqoQ#c_GlideRecordAPI "The GlideRecord API is used for database operations.") API. Use this API if you want to set the same group of dynamic attributes on multiple records. Using this API, you can stage a GlideDynamicAttributeStore object with the desired
attributes and then copy that object to multiple GlideRecords using the various setDynamicAttributeValues() methods. Using similar dynamic schema methods in the GlideRecord API performs the
actions on a specified GlideRecord.

## GlideDynamicAttributeStore - clear() {#ariaid-title2}

Clears all attributes and their values from the GlideDynamicAttributeStore object.
{#GDAS-clear__table_vfl_shq_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#GDAS-clear__table_vfl_shq_1bc} {#GDAS-clear__table_wfl_shq_1bc__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#GDAS-clear__table_wfl_shq_1bc}  
The following code example shows how to call this method.

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

Output:

    *** Script: das: {
      "cars" : {
        "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() {#ariaid-title3}

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.
{#GDAS-getDisplayValue__ul_vx3_gfq_tbc}
{#GDAS-getDisplayValue__table_cl2_cfq_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 3. Parameters]

{#GDAS-getDisplayValue__table_cl2_cfq_1bc} {#GDAS-getDisplayValue__table_dl2_cfq_1bc__entry__2}

| 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. |
[Table 4. Returns]

{#GDAS-getDisplayValue__table_dl2_cfq_1bc}  
The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("cars->color","blue");
    das.setDynamicAttributeValue("cars->make","Toyota");
    das.setDynamicAttributeValue("cars->model","CRV");
    das.setDynamicAttributeValue("cars->luxury",true);
    das.setDynamicAttributeValue("cars->cost",12000.5);
    das.setDynamicAttributeValue("cars->avg_mpg", 24.5234);
    das.setDynamicAttributeValue("cars->total_miles", 5324);
    das.setDynamicAttributeValue("cars->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(): {"cars":{"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(): {
      "cars" : {
        "avg_mpg" : "24.5234",
        "color" : "blue",
        "cost" : "12000.5",
        "date_purchased" : "2024-04-19 08:33:23",
        "luxury" : "true",
        "make" : "Toyota",
        "model" : "CRV",
        "total_miles" : "5324"
      }
    }

## GlideDynamicAttributeStore - getDynamicAttributeValue(String groupAttrPath) {#ariaid-title4}

Returns the value of the specified attribute within the dynamic attribute store element.
{#GDAS-getDynamicAttributeValue_S__table_psl_m3q_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| groupAttrPath | String | Attribute path to use to locate the associated dynamic schema attribute. Format: `"group_name->attr_name"` * `group_name`: Name of the group that the attribute is associated with. Located in the Name field of the Dynamic Attribute Group \[dynamic_attribute_group\] table or the Group field of the Dynamic Attribute \[dynamic_attribute\] table. * `attr_name`: Name of the dynamic attribute within the dynamic group. Located in the Name field of the Dynamic Attribute \[dynamic_attribute\] table. For example: `"car->color"` |
[Table 5. Parameters]

{#GDAS-getDynamicAttributeValue_S__table_psl_m3q_1bc} {#GDAS-getDynamicAttributeValue_S__table_qsl_m3q_1bc__entry__2}

| 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. |
[Table 6. Returns]

{#GDAS-getDynamicAttributeValue_S__table_qsl_m3q_1bc}  
The following code example shows how to call this method.

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

Output:

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

## GlideDynamicAttributeStore - getValue() {#ariaid-title5}

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.
{#GDAS-getValue__ul_un2_cgq_tbc}
{#GDAS-getValue__table_zyb_dcq_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 7. Parameters]

{#GDAS-getValue__table_zyb_dcq_1bc} {#GDAS-getValue__table_azb_dcq_1bc__entry__2}

| 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. |
[Table 8. Returns]

{#GDAS-getValue__table_azb_dcq_1bc}  
The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("cars->color","blue");
    das.setDynamicAttributeValue("cars->make","Toyota");
    das.setDynamicAttributeValue("cars->model","CRV");
    das.setDynamicAttributeValue("cars->luxury",true);
    das.setDynamicAttributeValue("cars->cost",12000.5);
    das.setDynamicAttributeValue("cars->avg_mpg", 24.5234);
    das.setDynamicAttributeValue("cars->total_miles", 5324);
    das.setDynamicAttributeValue("cars->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(): {"cars":{"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(): {
      "cars" : {
        "avg_mpg" : "24.5234",
        "color" : "blue",
        "cost" : "12000.5",
        "date_purchased" : "2024-04-19 08:33:23",
        "luxury" : "true",
        "make" : "Toyota",
        "model" : "CRV",
        "total_miles" : "5324"
      }
    }

## GlideDynamicAttributeStore - setDisplayValue(Object value) {#ariaid-title6}

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)](https://servicenow-prod.fluidtopics.net/wn4C7HdSWP5e0XYDL2fO2A#GDAS-setValue_O "Clears the current GlideDynamicAttributeStore object and then stores the passed JSON map in that GlideDynamicAttributeStore object."), except that it assumes that all date values are provided in the user's locale.
{#GDAS-setDisplayValue_O__table_zpm_m2j_1bc__entry__3}

| 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 {#GDAS-setDisplayValue_O__DynS-valid_data_types-ul} |
[Table 9. Parameters]

{#GDAS-setDisplayValue_O__table_zpm_m2j_1bc} {#GDAS-setDisplayValue_O__table_aqm_m2j_1bc__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 10. Returns]

{#GDAS-setDisplayValue_O__table_aqm_m2j_1bc}  
The following example shows how to call this method.

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

Output:

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

## GlideDynamicAttributeStore - setDynamicAttributeDisplayValue(String groupAttrPath, Object value) {#ariaid-title7}

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 groupAttrPath, Object value)](https://servicenow-prod.fluidtopics.net/wn4C7HdSWP5e0XYDL2fO2A#GDAS-setDynamicAttributeValue_S_O "Sets the dynamic attribute referenced by a specified group/attribute path to a specified 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.
{#GDAS-setDynamicAttDisplayValue_S_O__table_zqq_cxp_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| groupAttrPath | String | Attribute path to use to locate the associated dynamic schema attribute. Format: `"group_name->attr_name"` * `group_name`: Name of the group that the attribute is associated with. Located in the Name field of the Dynamic Attribute Group \[dynamic_attribute_group\] table or the Group field of the Dynamic Attribute \[dynamic_attribute\] table. * `attr_name`: Name of the dynamic attribute within the dynamic group. Located in the Name field of the Dynamic Attribute \[dynamic_attribute\] table. For example: `"car->color"` |
| 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 11. Parameters]

{#GDAS-setDynamicAttDisplayValue_S_O__table_zqq_cxp_1bc} {#GDAS-setDynamicAttDisplayValue_S_O__table_arq_cxp_1bc__entry__2}

| Type | Description |
|-|-|
| Object | Updated GlideDynamicAttributeStore object. If the groupAttrPath parameter isn't valid, the method throws an IllegalArgumentException. |
[Table 12. Returns]

{#GDAS-setDynamicAttDisplayValue_S_O__table_arq_cxp_1bc}  
The following code example shows how to call this method.

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

Output:

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

## GlideDynamicAttributeStore - setDynamicAttributeValue(String groupAttrPath, Object value) {#ariaid-title8}

Sets the dynamic attribute referenced by a specified group/attribute path to a specified value.
{#GDAS-setDynamicAttributeValue_S_O__table_zgx_1np_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| groupAttrPath | String | Attribute path to use to locate the associated dynamic schema attribute. Format: `"group_name->attr_name"` * `group_name`: Name of the group that the attribute is associated with. Located in the Name field of the Dynamic Attribute Group \[dynamic_attribute_group\] table or the Group field of the Dynamic Attribute \[dynamic_attribute\] table. * `attr_name`: Name of the dynamic attribute within the dynamic group. Located in the Name field of the Dynamic Attribute \[dynamic_attribute\] table. For example: `"car->color"` |
| 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 13. Parameters]

{#GDAS-setDynamicAttributeValue_S_O__table_zgx_1np_1bc} {#GDAS-setDynamicAttributeValue_S_O__table_ahx_1np_1bc__entry__2}

| Type | Description |
|-|-|
| Object | Updated GlideDynamicAttributeStore object. If the groupAttrPath parameter isn't valid, the method throws an IllegalArgumentException. |
[Table 14. Returns]

{#GDAS-setDynamicAttributeValue_S_O__table_ahx_1np_1bc}  
The following code example shows how to call this method.

    var das = new GlideDynamicAttributeStore();
    das.setDynamicAttributeValue("cars->color","blue");
    das.setDynamicAttributeValue("cars->make","Toyota");
    das.setDynamicAttributeValue("cars->model","CRV");
    das.setDynamicAttributeValue("cars->luxury",true);
    das.setDynamicAttributeValue("cars->cost",12000.5);
    das.setDynamicAttributeValue("cars->avg_mpg", 24.5234);
    das.setDynamicAttributeValue("cars->total_miles", 5324);
    das.setDynamicAttributeValue("cars->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(): {"cars":{"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(): {
      "cars" : {
        "avg_mpg" : "24.5234",
        "color" : "blue",
        "cost" : "12000.5",
        "date_purchased" : "2024-04-19 08:33:23",
        "luxury" : "true",
        "make" : "Toyota",
        "model" : "CRV",
        "total_miles" : "5324"
      }
    }

## GlideDynamicAttributeStore - setDynamicAttributeValues(Object value) {#ariaid-title9}

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.
{#GDAS-setDynamicAttributeValues_O__table_azz_kbp_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Object | JSON object to store as the value in the associated GlideRecord. The method ignores any invalid JSON values. |
[Table 15. Parameters]

{#GDAS-setDynamicAttributeValues_O__table_azz_kbp_1bc} {#GDAS-setDynamicAttributeValues_O__table_bzz_kbp_1bc__entry__2}

| Type | Description |
|-|-|
| Object | Updated GlideDynamicAttributeStore object. |
[Table 16. Returns]

{#GDAS-setDynamicAttributeValues_O__table_bzz_kbp_1bc}  
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","y":"6.0"}}

## GlideDynamicAttributeStore - setValue(Object value) {#ariaid-title10}

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)](https://servicenow-prod.fluidtopics.net/wn4C7HdSWP5e0XYDL2fO2A#GDAS-setDisplayValue_O "Clears the current GlideDynamicAttributeStore object and then stores the passed JSON map in the GlideDynamicAttributeStore object.") except that it assumes that all date values are in UTC.
{#GDAS-setValue_O__table_uh2_2hj_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Object | JSON map object to store in the GlideDynamicAttributeStore object. For example: `'{"cars":{"cost":"12500"}}'` This method ignores any invalid JSON values. |
[Table 17. Parameters]

{#GDAS-setValue_O__table_uh2_2hj_1bc} {#GDAS-setValue_O__table_vh2_2hj_1bc__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 18. Returns]

{#GDAS-setValue_O__table_vh2_2hj_1bc}  
The following example shows how to call this method.

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

Output:

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

## GlideDynamicAttributeStore - toString() {#ariaid-title11}

Returns the content of the GlideDynamicAttributeStore object as a string.
{#GDAS-toString__table_fgm_kgq_1bc__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 19. Parameters]

{#GDAS-toString__table_fgm_kgq_1bc} {#GDAS-toString__table_ggm_kgq_1bc__entry__2}

| Type | Description |
|-|-|
| String | GlideDynamicAttribute object as a string. For example: '{"group":{"attr2":"true","attr1":"42.0"}}' |
[Table 20. Returns]

{#GDAS-toString__table_ggm_kgq_1bc}  
The following code example shows how to call this method.

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

Output:

    *** Script: das: {"cars":{"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"}}


