【问题标题】:Netsuite email template codeNetsuite 电子邮件模板代码
【发布时间】:2017-09-19 19:16:27
【问题描述】:

您好,我正在为我的工作场所更新电子邮件模板。以下代码以红色打印出“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

【问题讨论】:

  • 如何确定 ${transaction.custbody3} 的数据类型?这将打印出采购订单编号,但如果没有编号,我不想打印任何内容。这将是另一个 if 语句,但我的猜测是数据类型是字符串?这是否意味着我会检查变量是否为空?任何帮助都会很棒。

标签: html email templates netsuite


【解决方案1】:

NetSuite 在其模板中使用 Freemarker。

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

&lt;span style="color:red:&gt;${customer.overdueBalance}&lt;/span&gt;

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

&lt;#if customer.overdueBalance == 0&gt;green&lt;#else&gt;red&lt;/#if&gt;

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

&lt;span style="color: &lt;#if customer.overdueBalance == 0&gt;green&lt;#else&gt;red&lt;/#if&gt;"&gt;${customer.overdueBalance}&lt;/span&gt;

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

【讨论】:

  • 感谢您的帮助。事实证明,该链接很有帮助
猜你喜欢
  • 2022-08-18
  • 1970-01-01
  • 1970-01-01
  • 2022-10-20
  • 1970-01-01
  • 2017-02-26
  • 1970-01-01
  • 1970-01-01
  • 2013-08-12
相关资源
最近更新 更多