Expand my Community achievements bar.

Check out the 3rd Edition of the AEP Community Lens for all the latest releases, resources, and Community updates
SOLVED

Retrieve all Data elements in custom code

Avatar

Level 2

Is it possible to return a full list of all data elements names in custom code (written under Rules)?

 

I have a few data elements and there will be new elements added in the future. I don't want to update my custom code every time a new element is added. Instead I want to GET a full list of data element names, then loop through the _satellite.getVar("<Data_element_name_here>") function in order to populate my query. 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Yes, you can! They're actually available inside the_satellite object.

Object.keys(_satellite._container.dataElements)
0 Replies

Avatar

Correct answer by
Community Advisor

Yes, you can! They're actually available inside the_satellite object.

Object.keys(_satellite._container.dataElements)

Avatar

Level 2
Perfect, thank you! Here's the start of my code encase anyone want to expand on it

Avatar

Level 2
for (let i = 0; i<Object.keys(_satellite._container.dataElements).length;i++) { let dataElementName = Object.keys(_satellite._container.dataElements)[i] console.log(dataElementName) }
page footer