{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":787,"path":"api-reference/server-api-reference/GlideDynamicAttStoreAPI.md","title":"GlideDynamicAttributeStore - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# GlideDynamicAttributeStore- Global\n\nUse the GlideDynamicAttributeStore API to create objects for working with dynamic attributes independently of a table or field.\n\nThis 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/dynamic-schema.md).\n\nTo 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.\n\nThere are methods in this API that have the same functionality as dynamic schema methods in the [GlideRecord](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideRecordAPI.md) 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.\n\n[GlideAggregate - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideAggregateAPI.md) methods usable with dynamic schema:\n\n-   addAggregate\\(\\)\n-   addHaving\\(\\)\n-   getDynamicAttributeValue\\(\\)\n-   getDynamicAttributeDisplayValue\\(\\)\n-   getValue\\(\\)\n-   groupBy\\(\\)\n-   orderBy\\(\\)\n-   orderByAggregate\\(\\)\n\n[GlideRecord - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideRecordAPI.md) methods usable with dynamic schema:\n\n-   addQuery\\(\\)\n-   getDisplayValue\\(\\)\n-   getDynamicAttribute\\(\\)\n-   getDynamicAttributeDisplayValue\\(\\)\n-   getDynamicAttributeValue\\(\\)\n-   getValue\\(\\)\n-   orderBy\\(\\)\n-   orderByDesc\\(\\)\n-   setDisplayValue\\(\\)\n-   setDynamicAttributeDisplayValue\\(\\)\n-   setDynamicAttributeValue\\(\\)\n-   setDynamicAttributeValues\\(\\)\n-   setValue\\(\\)\n\nSee also:\n\n-   [GlideDynamicAttributeStore - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicAttStoreAPI.md)\n-   [GlideDynamicNamespace - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicNamespaceAPI.md)\n-   [GlideElement - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideElementAPI.md)\n-   [GlideElementDynamicAttributeStore - Global](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideElementDynamicAttStoreAPI.md)\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## GlideDynamicAttributeStore - clear\\(\\)\n\nClears all attributes and their values from the GlideDynamicAttributeStore object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|None| |\n\nThe following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Toyota\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",true);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\",24.5234);\ndas.setDynamicAttributeValue(\"total_miles\",5324);    \ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('das: ' + das.getDisplayValue());\ndas.clear();\ngs.info('das: ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** Script: das: {\n  \"avg_mpg\" : \"24.5234\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.5\",\n  \"date_purchased\" : \"2024-04-19 08:29:52\",\n  \"luxury\" : \"true\",\n  \"make\" : \"Toyota\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324\"\n}\n*** Script: das: null\n```\n\n## GlideDynamicAttributeStore - getDisplayValue\\(\\)\n\nReturns the JSON map representation of the values stored in the current GlideDynamicAttributeStore object.\n\nThis method returns:\n\n-   Boolean values as \"true\" and \"false\" instead of 1 and 0.\n-   Date/time values in the user’s locale instead of UTC.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Human-readable JSON map of the values stored in the GlideDynamicAttributeStore object. The contents of this string depends on your dynamic schema definition.|\n\nThe following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Honda\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",false);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);\ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('Value returned by getValue(): ' + das.getValue());\ngs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** 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\"}\n*** Script: Value returned by getDisplayValue(): {\n  \"avg_mpg\" : \"24.5234\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.5\",\n  \"date_purchased\" : \"2024-04-19 08:33:23\",\n  \"luxury\" : \"false\",\n  \"make\" : \"Honda\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324\"\n}\n```\n\n## GlideDynamicAttributeStore - getDynamicAttribute\\(String attributePath\\)\n\nReturns dynamic attribute object located at a specified dynamic attribute path.\n\n<table id=\"table_gzs_jld_bbc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nattributePath\n\n</td><td>\n\nString\n\n</td><td>\n\nAttribute path to use to locate the associated dynamic schema attribute.Format: `\"attr_name\"`\n\n`attr_name`: Name of the dynamic attribute.\n\nTable: In the attribute field of the Dynamic Attribute \\[dynamic\\_attribute\\] table.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|IDynamicAttribute|Object containing dynamic attributes.|\n\nThe following code example shows how to call this method.\n\n```\n//Gets all the values of the make attribute from the u_inc_dynamic_schema dynamic attribute store column on the incident table\nvar gr_Inc = new GlideRecord('incident');\ngr_Inc.query();\nwhile(gr_Inc.next()) {\n    var attr = gr.getDynamicAttribute('inc_dynamic_schema->make');\n    gs.info(attr.getValue());\n}\n\n//You can also use if(gr_Inc.next()) if you don't want all the values\nvar gr_Inc = new GlideRecord('incident');\ngr_Inc.query();\nif(gr_Inc.next()) {\n    var attr = gr_Inc.getDynamicAttribute('inc_dynamic_schema->make');\n    gs.info(attr.getValue());\n}\n```\n\n## GlideDynamicAttributeStore - getDynamicAttributes\\(\\)\n\nReturns the set of dynamic attribute definitions present in the store.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_qsl_m3q_1bc\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nArray\n\n</td><td>\n\nArray 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicAttributeAPI.md).\n-   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.\n\n</td></tr></tbody>\n</table>The following example shows how to retrieve transient and non-transient dynamic attributes.\n\n```\nvar used_car = new GlideDynamicAttributeStore('u_product/u_car_inventory');\nused_car.setDynamicAttributeValue('mfg_year', 2014);       // transient (adding here)\nused_car.setDynamicAttributeValue('u_total_miles', 53246); // defined in dynamic_attribute table\n\nvar attributes = used_car.getDynamicAttributes();\ngs.info(attributes);\n\nfor (var i = 0; i < attributes.length; i++) {\n    var attr = attributes[i];\n    gs.info(\"\");\n    gs.info(\"[\" + i + \"].getPath()           = \" + attr.getPath());\n    gs.info(\"[\" + i + \"].getName()           = \" + attr.getName());\n    gs.info(\"[\" + i + \"].getNamespaceName()  = \" + attr.getNamespaceName());\n    gs.info(\"[\" + i + \"].getNamespacedName() = \" + attr.getNamespacedName());\n    gs.info(\"[\" + i + \"].isTransient()       = \" + attr.isTransient());\n    gs.info(\"[\" + i + \"].getType()           = \" + attr.getType());\n}\n```\n\nOutput:\n\n```\n*** Script: mfg_year,u_total_miles\n*** Script: \n*** Script: [0].getPath()           = mfg_year\n*** Script: [0].getName()           = mfg_year\n*** Script: [0].getNamespaceName()  = u_product/u_car_inventory\n*** Script: [0].getNamespacedName() = u_product/u_car_inventory/mfg_year\n*** Script: [0].isTransient()       = true\n*** Script: [0].getType()           = string\n*** Script: \n*** Script: [1].getPath()           = u_total_miles\n*** Script: [1].getName()           = u_total_miles\n*** Script: [1].getNamespaceName()  = u_product/u_car_inventory\n*** Script: [1].getNamespacedName() = u_product/u_car_inventory/u_total_miles\n*** Script: [1].isTransient()       = false\n*** Script: [1].getType()           = integer\n```\n\n## GlideDynamicAttributeStore - getDynamicAttributeValue\\(String attrPath\\)\n\nReturns the value of the specified attribute within the dynamic attribute store element.\n\n<table id=\"table_psl_m3q_1bc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nattrPath\n\n</td><td>\n\nString\n\n</td><td>\n\nAttribute path to use to locate the associated dynamic schema attribute.Format: `\"attr_name\"`\n\n`attr_name`: Name of the dynamic attribute.\n\nTable: In the attribute field of the Dynamic Attribute \\[dynamic\\_attribute\\] table.\n\n</td></tr></tbody>\n</table><table id=\"table_qsl_m3q_1bc\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nValue of the dynamic schema attribute referenced by the passed group/attribute path.If the **attributePath** parameter contains invalid information, returns a null.\n\n</td></tr></tbody>\n</table>The following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Toyota\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",true);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);\ndas.setDynamicAttributeValue(\"date_purchased\", new GlideDateTime());\ngs.info('Value returned by getDynamicAttributeValue(): ' + das.getDynamicAttributeValue(\"color\"));\ngs.info('Value returned by getDynamicAttributeValue(): ' + das.getDynamicAttributeValue(\"luxury\"));\n\n```\n\nOutput:\n\n```\n*** Script: Value returned by getDynamicAttributeValue(): blue\n*** Script: Value returned by getDynamicAttributeValue(): 1\n```\n\n## GlideDynamicAttributeStore - getDynamicNamespace\\(\\)\n\nReturns the dynamic namespace.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|Namespace object.|\n\nThe following example shows how to create a store using a dynamic namespace, and retrieve the name of the namespace.\n\n```\ngs.info(\"car_inventory = new GlideDynamicAttributeStore('u_product/u_car_inventory')\");\nvar car_inventory = new GlideDynamicAttributeStore(\"u_product/u_car_inventory\");\ngs.info(\"car_inventory.getDynamicNamespace() : \" + car_inventory.getDynamicNamespace());\nvar ns1 = car_inventory.getDynamicNamespace();\n```\n\nOutput:\n\n```\n*** Script: new_cars = new GlideDynamicAttributeStore('u_product/u_car_inventory')\n*** Script: new_cars.getDynamicNamespace() : u_product/u_car_inventory\n```\n\n## GlideDynamicAttributeStore - getValue\\(\\)\n\nReturns the compact string representation of the contents of the current GlideDynamicAttributeStore object.\n\nThis method returns:\n\n-   Boolean values as 1 and 0 instead of \"true\" and \"false\".\n-   Date/time values in UTC instead of the user’s locale.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Compact string representation of the values stored in the GlideDynamicAttributeStore object. The contents of this string depends on your dynamic schema definition.|\n\nThe following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Honda\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",false);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);\ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('Value returned by getValue(): ' + das.getValue());\ngs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** 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\"}\n*** Script: Value returned by getDisplayValue(): {\n  \"avg_mpg\" : \"24.5234\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.5\",\n  \"date_purchased\" : \"2024-04-19 08:33:23\",\n  \"luxury\" : \"false\",\n  \"make\" : \"Honda\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324\"\n}\n```\n\n## GlideDynamicAttributeStore - setDisplayValue\\(Object value\\)\n\nClears the current GlideDynamicAttributeStore object and then stores the passed JSON map in the GlideDynamicAttributeStore object.\n\nThis method is functionally the same as [GlideDynamicAttributeStore - setValue\\(Object value\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicAttStoreAPI.md), except that it assumes that all date values are provided in the user's locale.\n\n<table id=\"table_zpm_m2j_1bc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nvalue\n\n</td><td>\n\nObject\n\n</td><td>\n\nValue to set in the current dynamic attribute store object.The passed value must be of one of the following data types:\n\n-   Boolean \\(True/False\\)\n-   Decimal\n-   Floating Point Number\n-   GlideDate\n-   GlideDateTime\n-   Integer\n-   String\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|None| |\n\nThe following example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Honda\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",false);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);    \ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('das: ' + das.getDisplayValue());\ndas.setDisplayValue('{\"luxury\":false}');\ngs.info('das: ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** Script: das: {\n  \"avg_mpg\" : \"24.5\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.0\",\n  \"date_purchased\" : \"2024-04-19 14:16:49\",\n  \"luxury\" : \"false\",\n  \"make\" : \"Honda\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324.0\"\n}\n*** Script: das: {\n  \"luxury\" : \"false\"\n}\n```\n\n## GlideDynamicAttributeStore - setDynamicAttributeDisplayValue\\(String attrPath, Object value\\)\n\nSets the value of the dynamic attribute located at a specified path within a dynamic attribute store element.\n\nThis method works the same as the [GlideDynamicAttributeStore - setDynamicAttributeValue\\(String attrPath, Object value\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicAttStoreAPI.md) 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.\n\n<table id=\"table_zqq_cxp_1bc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nattrPath\n\n</td><td>\n\nString\n\n</td><td>\n\nAttribute path to use to locate the associated dynamic schema attribute.Format: `\"attr_name\"`\n\n`attr_name`: Name of the dynamic attribute.\n\nTable: In the attribute field of the Dynamic Attribute \\[dynamic\\_attribute\\] table.\n\n</td></tr><tr><td>\n\nvalue\n\n</td><td>\n\nObject\n\n</td><td>\n\nValue to set in the specified attribute.**Note:** For dynamic attributes, only the following data types are supported:\n\n-   Boolean \\(True/False\\)\n-   Decimal\n-   Floating Point Number\n-   GlideDate\n-   GlideDateTime\n-   Integer\n-   String\n\n</td></tr></tbody>\n</table><table id=\"table_arq_cxp_1bc\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nUpdated GlideDynamicAttributeStore object.If the **attrPath** parameter isn't valid, the method throws an `IllegalArgumentException`.\n\n</td></tr></tbody>\n</table>The following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeDisplayValue(\"color\",\"blue\");\ndas.setDynamicAttributeDisplayValue(\"make\",\"Honda\");\ndas.setDynamicAttributeDisplayValue(\"model\",\"CRV\");\ndas.setDynamicAttributeDisplayValue(\"luxury\",\"false\");\ndas.setDynamicAttributeDisplayValue(\"cost\",12000.5);\ndas.setDynamicAttributeDisplayValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeDisplayValue(\"total_miles\", 5324);    \ndas.setDynamicAttributeDisplayValue(\"date_purchased\",new GlideDateTime());\ngs.info('das: ' + das.getDisplayValue());\ndas.setDisplayValue('{\"luxury\":\"false\"}');\ngs.info('das: ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** Script: das: {\n  \"avg_mpg\" : \"24.5234\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.5\",\n  \"date_purchased\" : \"2024-04-19 10:40:45\",\n  \"luxury\" : \"false\",\n  \"make\" : \"Honda\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324\"\n}\n*** Script: das: {\n  \"luxury\" : \"false\"\n}\n```\n\n## GlideDynamicAttributeStore - setDynamicAttributeValue\\(String attrPath, Object value\\)\n\nSets the dynamic attribute referenced by a specified attribute path to a specified value.\n\n<table id=\"table_zgx_1np_1bc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nattrPath\n\n</td><td>\n\nString\n\n</td><td>\n\nAttribute path to use to locate the associated dynamic schema attribute.Format: `\"attr_name\"`\n\n`attr_name`: Name of the dynamic attribute.\n\nTable: In the attribute field of the Dynamic Attribute \\[dynamic\\_attribute\\] table.\n\n</td></tr><tr><td>\n\nvalue\n\n</td><td>\n\nObject\n\n</td><td>\n\nValue to set in the specified attribute.**Note:** For dynamic attributes, only the following data types are supported:\n\n-   Boolean \\(True/False\\)\n-   Decimal\n-   Floating Point Number\n-   GlideDate\n-   GlideDateTime\n-   Integer\n-   String\n\n</td></tr></tbody>\n</table><table id=\"table_ahx_1np_1bc\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nUpdated GlideDynamicAttributeStore object.If the **attrPath** parameter isn't valid, the method throws an `IllegalArgumentException`.\n\n</td></tr></tbody>\n</table>The following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Honda\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",false);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);\ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('Value returned by getValue(): ' + das.getValue());\ngs.info('Value returned by getDisplayValue(): ' + das.getDisplayValue());\n```\n\nOutput:\n\n```\n*** 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\"}\n*** Script: Value returned by getDisplayValue(): {\n  \"avg_mpg\" : \"24.5234\",\n  \"color\" : \"blue\",\n  \"cost\" : \"12000.5\",\n  \"date_purchased\" : \"2024-04-19 08:33:23\",\n  \"luxury\" : \"false\",\n  \"make\" : \"Honda\",\n  \"model\" : \"CRV\",\n  \"total_miles\" : \"5324\"\n}\n```\n\n## GlideDynamicAttributeStore - setDynamicAttributeValues\\(Object value\\)\n\nSets 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|value|Object|JSON object to store as the value in the associated GlideRecord. The method ignores any invalid JSON values.|\n\n|Type|Description|\n|----|-----------|\n|Object|Updated GlideDynamicAttributeStore object.|\n\nThe following example shows how to store attribute/value pairs in a GlideDynamicAttributeStore object and then copy those same values from one object to another.\n\n```\nvar das = new GlideDynamicAttributeStore();\nvar otherValues = new GlideDynamicAttributeStore();\notherValues.setDynamicAttributeValue(\"position_x\", 5);\notherValues.setDynamicAttributeValue(\"position_y\", 6);\n\ndas.setDynamicAttributeValues(otherValues);\ngs.info(das);\n```\n\nOutput:\n\n```\n{\"position_x\":\"5.0\",\"position_y\":\"6.0\"}\n```\n\n## GlideDynamicAttributeStore - setDynamicNamespace\\(String namespaceName\\)\n\nSets a dynamic namespace name.\n\n|Name|Type|Description|\n|----|----|-----------|\n|namespaceName|String|Dynamic namespace name.|\n\n|Type|Description|\n|----|-----------|\n|Object|Updated GlideDynamicAttributeStore object.|\n\nThe following example shows how to sets the name of a default namespace to `namespace1`.\n\n```\ngs.info(\"store1 = new GlideDynamicAttributeStore()\");\nvar store1 = new GlideDynamicAttributeStore();\ngs.info(\"store1.getDynamicNamespace() : \" + store1.getDynamicNamespace());\ngs.info(\"store1.setDynamicNamespace('namespace1')\");\nstore1.setDynamicNamespace('namespace1');\ngs.info(\"store1.getDynamicNamespace() : \" + store1.getDynamicNamespace());\n```\n\nOutput:\n\n```\n*** Script: store1 = new GlideDynamicAttributeStore()\n*** Script: store1.getDynamicNamespace() : default\n*** Script: store1.setDynamicNamespace('namespace1')\n*** Script: store1.getDynamicNamespace() : namespace1\n```\n\n## GlideDynamicAttributeStore - setValue\\(Object value\\)\n\nClears the current GlideDynamicAttributeStore object and then stores the passed JSON map in that GlideDynamicAttributeStore object.\n\nThis method is functionally the same as [GlideDynamicAttributeStore - setDisplayValue\\(Object value\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideDynamicAttStoreAPI.md) except that it assumes that all date values are in UTC.\n\n<table id=\"table_uh2_2hj_1bc\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nvalue\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON map object to store in the GlideDynamicAttributeStore object. For example: `'{\"cost\":\"12500\"}'`\n\nThis method ignores any invalid JSON values.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|None| |\n\nThe following example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Toyota\");\ndas.setDynamicAttributeValue(\"model\",\"Rav4\");\ndas.setDynamicAttributeValue(\"luxury\",false);\ndas.setDynamicAttributeValue(\"cost\",12000.5);\ndas.setDynamicAttributeValue(\"avg_mpg\", 24.5234);\ndas.setDynamicAttributeValue(\"total_miles\", 5324);    \ndas.setDynamicAttributeValue(\"date_purchased\", new GlideDateTime());\ngs.info('das: ' + das.getValue());\ndas.setValue('{\"luxury\":false}');\ngs.info('das: ' + das.getValue());\n```\n\nOutput:\n\n```\n*** 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\"}\n*** Script: das: {\"luxury\":false}\n```\n\n## GlideDynamicAttributeStore - toString\\(\\)\n\nReturns the content of the GlideDynamicAttributeStore object as a string.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_ggm_kgq_1bc\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nGlideDynamicAttribute object as a string.For example: `'{\"attr2\":\"true\",\"attr1\":\"42.0\"}'`\n\n</td></tr></tbody>\n</table>The following code example shows how to call this method.\n\n```\nvar das = new GlideDynamicAttributeStore();\ndas.setDynamicAttributeValue(\"color\",\"blue\");\ndas.setDynamicAttributeValue(\"make\",\"Toyota\");\ndas.setDynamicAttributeValue(\"model\",\"CRV\");\ndas.setDynamicAttributeValue(\"luxury\",true);\ndas.setDynamicAttributeValue(\"cost\",12000);\ndas.setDynamicAttributeValue(\"avg_mpg\",24.5);\ndas.setDynamicAttributeValue(\"total_miles\",5324);    \ndas.setDynamicAttributeValue(\"date_purchased\",new GlideDateTime());\ngs.info('das: ' + das.toString());\n```\n\nOutput:\n\n```\n*** 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\"}\n\n```\n\n"}}