How to access data elements in custom code
Is there a way to reference the data elements I have created inside a snippet of custom code in the code editor?
var bkprop4 = "%myDataElement%";
Is there a way to reference the data elements I have created inside a snippet of custom code in the code editor?
var bkprop4 = "%myDataElement%";
You bet you can.
var bkprop4 = _satellite.getVar("myDataElement");
The % signs are just for use in the UI. They can also be used in HTML tags - I'm pretty sure that they trigger replacement during the rendering process.
You can also use _satellite.setVar("variableName", value) in your custom code, but only for new data elements. You cannot change the value of a UI created data element using setVar. I like to use a standard naming convention when I dynamically create data elements using _satellite.setVar. This way I have no chance of conflicting with UI data elements.
One more point. I often will create a data element in a rule's custom code and then reference it from the UI in an action. When doing this, you need to manually enter it in the UI field (using the %name% notation as normal).
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.