Netsuite电子邮件模板代码

时间:2017-09-19 19:16:27

标签: html email templates netsuite

您好我正在为我的工作场所更新电子邮件模板。以下代码打印出红色的“customer.overdueBalance”变量。我需要帮助获取if else语句,该值将在值为零时打印绿色余额,并在有余额时打印红色。

Russell Pacific | Invoice ${transaction.tranId}



<span style="background-color: rgb(255, 255, 255);">Hello Accounts Payable,</span><br />
<br />
<span style="background-color: rgb(255, 255, 255);">Attached is your invoice, ${transaction.tranId}, for ${transaction.createdfrom}, from ${customer.companyName} PO ${transaction.custbody3}.</span><br />
<br />
Date Due: ${transaction.dueDate}<br />
Amount Due: ${transaction.total}<br />
<br />
<u><strong>Current Financial Snapshot</strong></u><br />

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td><strong><span style="background-color: rgb(255, 255, 255);">Total Balance:</span></strong></td>
<td><strong><span style="background-color: rgb(255, 255, 255);"> ${customer.balance}</span></strong></td>
</tr>
<tr>
<td><strong><span style="background-color: rgb(255, 255, 255);">Balance Past Due:</span></strong></td>
<td><span style="color: rgb(255, 0, 0);"><strong><span style="background-color: rgb(255, 255, 255);"> ${customer.overdueBalance}</span></strong></span></td>
</tr>
</tbody>
</table>
<br />
<br />
<span style="background-color: rgb(255, 255, 255);">If you have any questions, please do not hesitate to contact us.</span><br />
<br />
<span style="background-color: rgb(255, 255, 255);">Best Regards, </span><br />
<span style="background-color: rgb(255, 255, 255);">${preferences.MESSAGE_SIGNATURE}</span>

对于RGB通道绿色,175可以工作

Here is the output

1 个答案:

答案 0 :(得分:1)

NetSuite正在他们的模板中使用Freemarker。

首先,您需要创建一个span标记

<span style="color:red:>${customer.overdueBalance}</span>

然后你需要创建freemarker if else语句返回你需要的值。

<#if customer.overdueBalance == 0>green<#else>red</#if>

将if else语句放在span标记上。

<span style="color: <#if customer.overdueBalance == 0>green<#else>red</#if>">${customer.overdueBalance}</span>

您可能也想查看http://freemarker.org/