Netsuite电子邮件模板代码

问题描述:

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

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

+0

如何确定$ {transaction.custbody3}的数据类型?这将打印一张采购订单号,但如果没有号码,我不打印任何东西。这将是另一个如果陈述,但我的猜测是数据类型将是一个字符串?这是否意味着我会检查变量是否为空?任何帮助都会很棒。 –

NetSuite公司在他们的模板使用Freemarker的工作。

首先,你需要创建一个span标签

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

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

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

把如果else语句你跨越标签。

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

你可能要检查的http://freemarker.org/了。

+0

感谢您的帮助。该链接被证明是很有帮助的 –