GlideElementDynamicAttributeStore - Global

concept australia Updated Sep 10, 2026 8 min read GlideElementDynamicAttStoreAPI.md
Raw file servicenow.com

The GlideElementDynamicAttributeStore API provides convenient script methods for managing dynamic attributes in the current glide record. Use these methods in conjunction with the GlideRecord API to get and set defined dynamic attribute values.

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.

This API extends the GlideElement - Global API.

See also Dynamic Schema.

See also:

Parent Topic:Server API reference

GlideElementDynamicAttributeStore - getDynamicAttributeDisplayValue(String attributePath)

Returns the display value of the dynamic attribute located at a specified attribute path within a dynamic attribute store. If a display value is not available, it returns the internal value.

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.

Type

Description

Object

Value for the associated dynamic attribute in human-readable format.If the attributePath parameter contains invalid information, returns a null.

The following code example shows how to call this method.
JavaScript
//Gets all the display values of the luxury attribute from the inc_dynamic_schema dynamic attribute store column on the incident tablevar gr_Inc = new GlideRecord('incident');gr_Inc.query();while(gr_Inc.next()) {    var attr = gr_Inc.getDynamicAttributeDisplayValue('inc_dynamic_schema->luxury');    gs.info(attr);}
//You can also use if(gr.next()) if you don't want all the valuesvar gr_Inc = new GlideRecord('incident');gr_Inc.query();
if(gr_Inc.next()) {    var attr = gr_Inc.getDynamicAttributeDisplayValue('inc_dynamic_schema->luxury');    gs.info(attr);}

GlideElementDynamicAttributeStore - getDynamicAttributePathsInSchema()

Returns the set of dynamic attribute paths that are present in the schema configured for the store.

Name Type Description
None
Type Description
Array Array of attribute paths as strings.

The following example shows how to return the dynamic attribute paths that are present in the schema and configured for the store.

JavaScript
var gr_Inc = new GlideRecord('incident');gr_Inc.get('number', 'INC0009009');gs.info(gr_Inc.inc_dynamic_schema.getDynamicAttributePathsInSchema());

Output:

Text
number,short_description,active

GlideElementDynamicAttributeStore - getDynamicAttributePathsInStore()

Returns the set of dynamic attribute paths that are present in the store.

Name Type Description
None
Type Description
Array Array of attribute paths as strings.

The following example shows how to return the dynamic attribute paths that are present in the store.

JavaScript
var gr_Inc = new GlideRecord('incident');gr_Inc.get('number', 'INC0009009');gs.info(gr_Inc.inc_dynamic_schema.getDynamicAttributePathsInStore());

Output:

Text
severity,number,opened_at,short_description,urgency,opened_by,impact,active,description,state,priority

GlideElementDynamicAttributeStore - getDynamicAttributesInStore()

Returns the set of dynamic attribute definitions that are present and stored in a field.

Name Type Description
None
Type Description
Array Array of GlideDynamicAttribute objects.

The following example shows how to retrieve the contents of a stored dynamic attribute, list the attributes it stored, and the attributes in its schema.

JavaScript
var record = new GlideRecord('cool_thing');record.get('number', 'COOL0000005');
gs.info("Store Contents:\n" + JSON.stringify(JSON.parse(record.store1), null, 2) + "\n");gs.info("Attributes in Store:\n" + record.store1.getDynamicAttributesInStore() + "\n");gs.info("Attributes in Schema:\n" + record.store1.getDynamicAttributesInSchema() + "\n");

Output:

CSS
*** Script: Store Contents:{  {    "b": "hello world"  },  {    "integer1": "5"  },  {    "integer1": "10",    "string1": "hello"  }}
*** Script: Attributes in Store: b,integer1,integer1,string1
*** Script: Attributes in Schema:integer1,string1,integer1

GlideElementDynamicAttributeStore - getDynamicAttributesInSchema()

Returns the set of dynamic attribute definitions that are pointed to in the schema.

Name Type Description
None
Type Description
Array Array of GlideDynamicAttribute objects.

The following example shows how to retrieve the contents of a stored dynamic attribute, list the attributes it stored, and the attributes in its schema.

JavaScript
var record = new GlideRecord('cool_thing');record.get('number', 'COOL0000005');
gs.info("Store Contents:\n" + JSON.stringify(JSON.parse(record.store1), null, 2) + "\n");gs.info("Attributes in Store:\n" + record.store1.getDynamicAttributesInStore() + "\n");gs.info("Attributes in Schema:\n" + record.store1.getDynamicAttributesInSchema() + "\n");

Output:

CSS
*** Script: Store Contents:{  {    "b": "hello world"  },  {    "integer1": "5"  },  {    "integer1": "10",    "string1": "hello"  }}
*** Script: Attributes in Store: b,integer1,integer1,string1
*** Script: Attributes in Schema:integer1,string1,integer1

GlideElementDynamicAttributeStore - getDynamicAttributeValue(String attributePath)

Returns the internal value of the dynamic attribute pointed to by a passed-in attribute path within a dynamic attribute store.

See also Dynamic Schema.

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.

Type

Description

Object

Value of the dynamic attribute pointed to by the passed attribute path.If the attributePath parameter contains invalid information, returns a null.

The following code example shows how to call this method.
JavaScript
var gr_Inc = new GlideRecord('incident');gr_Inc.query();
while(gr_Inc.next()) {    var attr = gr_Inc.getDynamicAttributeValue('inc_dynamic_schema->luxury');    gs.info(attr);}

Output:

Text
*** Script: 1

GlideElementDynamicAttributeStore - getDynamicNamespace()

Returns a dynamic namespace that is configured for the store.

Name Type Description
None
Type Description
IDynamicNamespace Dynamic namespace object information.

The following example shows how to return the dynamic namespace object configured for the store.

JavaScript
var gr_Inc = new GlideRecord('incident');gr_Inc.query();if (gr_Inc.next()) {    var namespace = gr_Inc.inc_dynamic_schema.getDynamicNamespace();     gs.info("toString:    " + namespace);    gs.info("name:        " + namespace.getName());    gs.info("isActive:    " + namespace.isActive());    gs.info("isTransient: " + namespace.isTransient());}

Output:

YAML
toString:    incident/inc_dynamic_schemaname:        incident/inc_dynamic_schemaisActive:    trueisTransient: false

GlideElementDynamicAttributeStore - getDynamicNamespaceName()

Gets the name of the dynamic namespace that is configured for the store.

Name Type Description
None
Type Description
String Name of the dynamic namespace.

The following example shows how to return the name of the dynamic namespace configured for the store.

JavaScript
var gr_Inc = new GlideRecord('incident');gr_Inc.query();if (gr_Inc.next()) {    gs.info(gr_Inc.inc_dynamic_schema.getDynamicNamespaceName());}

Output:

Text
incident/inc_dynamic_schema

GlideElementDynamicAttributeStore - setDynamicAttributeValue(String attributePath, Object value)

Sets the attribute pointed to by a specified attribute path in a dynamic attribute store to a specified value.

See also Dynamic Schema.

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.

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

Type

Description

GlideElementDynamicAttributeStore

Returns a GlideElementDynamicAttributeStore object containing the specified value.If the attributePath parameter contains invalid information, the attribute is not updated.

The following code example shows how to call this method.
JavaScript
//This simple example inserts a make attribute on the inc_dynamic_schema column where the value of the make attribute is Ford.var gr_Inc = new GlideRecord('incident');gr_Inc.setDynamicAttributeValue('inc_dynamic_schema->make', 'Ford');gr_Inc.insert();

GlideElementDynamicAttributeStore - setDynamicAttributeValues(GlideDynamicAttributeStore values)

Sets the values specified in the passed GlideElementDynamicAttributeStore object in the dynamic attribute store of the current GlideRecord element. The current element's data type must be set to Dynamic Attribute Store.

See also Dynamic Schema.

Name Type Description
values GlideDynamicAttributeStore Object that contains the values to set in the current element's dynamic schema. Values not specified in this object are not updated.
Type Description
GlideElementDynamicAttributeStore Updated GlideElementDynamicAttributeStore object.

The following code example shows how to call this method.

JavaScript
var gr_Inc = new GlideRecord('incident');var das = new GlideDynamicAttributeStore();das.setDynamicAttributeValue("color", "black");das.setDynamicAttributeValue("make","Honda");das.setDynamicAttributeValue("model","CRV");gr_Inc.setDynamicAttributeValues('inc_dynamic_schema', das);gr_Inc.insert();

This code example inserts the following in the u_inc_dynamic_schema column:

JSON
{  "color" : "black",  "make" : "Honda",  "model" : "CRV"}

GlideElementDynamicAttributeStore - setDynamicAttributeDisplayValue(String attributePath)

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

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.

value

Object

Value to set in the current dynamic attribute element.The passed value must be of one of the following data types:

  • Boolean (True/False)
  • Decimal
  • Floating Point Number
  • GlideDate
  • GlideDateTime
  • Integer
  • String
|Type|Description| |----|-----------| |GlideElementDynamicAttributeStore|Object that contains the updated glide element.|

The following code example shows how to call this method.

JavaScript
var grFleet = new GlideRecord('u_car_fleet');grFleet.setDynamicAttributeValue('u_dyn_attr_store', 'color', 'Yellow');grFleet.setDynamicAttributeValue('u_dyn_attr_store', 'make', 'Ford');var sysId = grFleet.insert();gs.info("Inserted: " + grFleet.u_dyn_attr_store);
var daStore = new GlideDynamicAttributeStore();daStore.setDynamicAttributeValue('color', 'Green');daStore.setDynamicAttributeValue('model', 'Bronco');
var geDynAttrStore = grFleet.getElement('u_dyn_attr_store');geDynAttrStore.setDynamicAttributeDisplayValues(daStore);grFleet.update();gs.info("Updated:  " + grFleet.u_dyn_attr_store);

Output:

CSS
*** Script: Inserted: {"color":"Yellow","make":"Ford"}*** Script: Updated:  {"color":"Green","make":"Ford","model":"Bronco"}

The following code example shows how a Boolean display value is stored as "1" but is passed back as "true".

JavaScript
 var gr_Inc = new GlideRecord('incident');gr_Inc.setDynamicAttributeDisplayValue('u_inc_dynamic_schema->u_luxury', '1');gr_Inc.insert()

Returned value:

JSON
{  "u_luxury" : "true"}

GlideElementDynamicAttributeStore - setDynamicAttributeDisplayValues(GlideDynamicAttributeStore values)

Sets the display values specified in the passed GlideDynamicAttributeStore object in the dynamic attributes of the current GlideRecord element. The current element's data type must be set to Dynamic Attribute Store in the associated table.

Name

Type

Description

values

GlideDynamicAttributeStore

Object that contains the display values to set in the current element's dynamic attribute store. Display values not specified in this object are not updated. This object must contain both the attribute path and the display value for each attribute to store.For example:

JSON
{  "color":"Blue",  "make":"Ford",  "model":"Mustang"}
|Type|Description| |----|-----------| |GlideElementDynamicAttributeStore|Object that contains the updated glide element.|

The following code example shows how to call this method.

JavaScript
var daStore = new GlideDynamicAttributeStore();daStore.setDynamicAttributeValue('make', 'Ford');daStore.setDynamicAttributeValue('model', 'Mustang');daStore.setDynamicAttributeValue('color', 'Blue');gs.info("daStore: " + daStore);
var gr_Car = new GlideRecord('u_car_fleet');gr_Car.query();while(gr_Car.next()) {  var glideElement = gr_Car.getElement('u_dyn_attr_store');  glideElement.setDynamicAttributeValues(daStore);  gr_Car.update();}

Output:

CSS
daStore: {"color":"Blue","model":"Mustang","make":"Ford"}
Search documentation
Search document titles and file paths on the australia branch