Retrieve all Data elements in custom code | Community
Skip to main content
Level 2
July 22, 2021
Solved

Retrieve all Data elements in custom code

  • July 22, 2021
  • 1 reply
  • 1891 views

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. 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by yuhuisg

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

Object.keys(_satellite._container.dataElements)

1 reply

yuhuisg
Community Advisor
yuhuisgCommunity AdvisorAccepted solution
Community Advisor
July 24, 2021

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

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