Automatically list payload path sub-objects?


First a suggestion: in the experience view render log, make the fields do that clickable “copy full key path” thing like what they do in a workflow debug. Its such a useful little feature, should be available everywhere.

Second - is there a way to automatically list all the sub-objects of a payload? I dont know the correct terminology, but as an example: if there are multiple devices returned from a get device node, how do we list each of them on an experience view automatically?
Writing them manually means that if something changes in the workflow data then it wont be reflected in the experience view unless I remember to change.



Great suggestion with the right-click menu. We’ll get that added.

The easiest solution to list all items in an array is to use the {{#each}} helper. Your above example would then change to:

{{#each pageData.output.getDevice}}

We use Handlebars as our templating language. There’s a ton of great resources online, especially on Stack Overflow. I’ve definitely used Stack Overflow answers more than once when it comes to more complicated Handlebars syntax.

The {{#each}} helper is provided by Handlebars, but we’ve also added a bunch of our own helpers for common tasks.



Excellent, thanks! Can this each method also be used in a workflow?
If we needed to break out the multiple array items into math node or a raw function?



The each helper will work in most template fields in the workflow engine. It typically makes sense for things like the email node where you want to render a list of things in the email body. It probably doesn’t work well in a math node.

Handlebars do not work in the function node, but at that point you’re just using JavaScript. So you’d just use a for loop to iterate items in an array on the payload.