Reputation: 1
I'm trying to take a current email template that my organization uses to request an order deposit based on the customer's current pending transaction so freemarker works fine to grab ${transaction.tranId} and such.
I have a new requirement to grab a transaction line level hyperlink and send it out with the email request, but I only want to send it if that data exists and only for the items that the link applies to.
<#if (record.item.custcol1)?has_content>
<p><strong>Please re-review the following artwork proof link(s) associated with your order:</strong></p>
<table style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item>
<thead>
<tr>
<th align="left" colspan="3" style="padding: 10px 6px;">${item.custcol1@label}</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" colspan="3" line-height="150%">${item.custcol1}</td>
</tr>
</#list><!-- end items -->
</tbody>
</table>
<hr style="width: 100%; color: #d3d3d3; background-color: #d3d3d3; height: 1px;" /></#if>
I can't seem to access the line level data in the same way that I would in a PDF form. I've tried the code without the if statement on a known record where I know I have data to access but it won't pull the fields into the email.
Upvotes: 0
Views: 990
Reputation: 2182
It looks like your <#list>
should only be around the table rows, like this:
<table style="width: 100%; margin-top: 10px;">
<thead>
<tr>
<th align="left" colspan="3" style="padding: 10px 6px;">${item.custcol1@label}</th>
</tr>
</thead>
<tbody>
<#list record.item as item>
<tr>
<td align="left" colspan="3" line-height="150%">${item.custcol1}</td>
</tr>
</#list>
</tbody>
</table>
Upvotes: 1