How to send list of objects using single send APi



How to send list of objects to email template using custom property in single send api. Please go through below example template.

{{custom.RecommendationSteps }}

{% for item in custom.RecommendationSteps %}

Topic Name: {{item.TopicName}}

{% endfor %}

{"name":"RecommendationSteps", "value":[{"name":"TopicName", "value":"TopicNamexyz"},{"name":"TopicName", "value":"xyz"}]


Welcome, @Bharat_Challapally!

At this time, custom properties passed via the single send API cannot be used in HubL for loops.

The reasoning is the same as it is for if statements — all HubL logic executes before custom properties and tokens are populated.

Here are some related topics:

The team understands this is a pain point and hopes to support greater HubL flexibility in email templates in the future.

In the meantime, the best way to surface multiple property values in the same template is to pre-render the values in an HTML table and pass the HTML into the custom token.

Something like:


     "message": {"to":""},
          {"name":"Table", "value": "<div><ul><li>TopicNameABC<\/li><li>TopicNameXYZ<\/li><\/ul><\/div>"

While this method works, I recognize it isn't an ideal solution and places the burden on you as the developer.