How to use for loop in transactional message center
Hi,
I have written below code in transactional message center email template.
<% var ctx = XML(rtEvent.ctx); %>
<% for(var i=1;i <=rtEvent.ctx.firstName.length;i++){%>
<%=escapeXmlStr(rtEvent.ctx.firstName[i])%>
<% }%>
and below is the ctx format which passing from postman application-
<ctx>
<firstName1>ABC</firstName1>
<age1>30</age1>
<firstName2>PQR</firstName2>
<age2>40</age2>
</ctx>
I am expecting output in below format-
| ABC | 30 |
| PQR | 40 |
What code should I write in template to display this output?
Thanks in advance.