Using one to many relationship in email personalization
Hi all,
Hope someone can help here. What I would like to do is iterate through an unknown number of records in a 1:many relationship to the recipient schema, to display any number of records in an email.
Assume I have a recipient table and a recommended product table. Depending on the recipient's purchased product, and their product history, they could have any number of product recommendations. Is it possible to just define the relationship and then reference it in the email template? Something like:
<% foreach (product in recipient.recommendedProducts) { %>
some HTML that may reference product.Image, product.productName, etc.
<% } %>
I am getting the loop to iterate through the correct number of products, but when I reference "product.productName" (for example) it is returning "undefined".
Thanks