Christian Gonzalez
Christian Gonzalez

Reputation: 21

Netsuite email template code

Hello i am working on updating an email template for my workplace. following code prints out a "customer.overdueBalance" variable in the color red. I need help getting an if else statement that will print that balance green when the value is zero and to print red when there is a balance due.

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>

for the RGB channel Green, 175 would work

Here is the output

Upvotes: 2

Views: 2942

Answers (1)

vVinceth
vVinceth

Reputation: 915

NetSuite is using Freemarker in their template.

First you need to create a span tag

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

Then you need to create freemarker if else statement returning the value that you required.

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

Put the if else statement on you span tag.

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

You might want to check the http://freemarker.org/ too.

Upvotes: 2

Related Questions