I have a problem I'm trying to solve with the advanced PDF templates in Netsuite. Here is an outline of the problem, and below that is the basic outline of the current code in place.
We have a group of companies (let's say they all include Company ABC
in their name)
Occasionally we receive orders from this company without them being approved. This results in the record.otherrefnum
to start with SC 100
(or SC100
)
I want the below scenario in the template and I need some help with how to structure this correctly. I have added a custom checkbox to the orderform scoverride
So basically, I want to be able to TICK this box, which will override the inital IF statement.
IF scoverride?string == "No" AND entity contains 'COMPANY ABC' AND otherrefnum contains 'SC100' THEN show table1
UNLESS scoverride?string == "YES" THEN show table2
IF entity does not contain 'COMPANY ABC' show table2*
*The problem is that this checkbox will default to being unticked, and for all our other clients this won't be an issue. That's why I need this 3rd argument included
<#if record.entity?contains("Company ABC") && record.otherrefnum?contains("SC 100") || record.otherrefnum?contains("SC100")>
<table id="table1">
<tr><td>Shopping Cart Number is invalid.</td></tr>
</table>
<#else>
<table id="table2">
<tr><td>${record.otherrefnum}</td></tr></table>
</#if>
Another way of putting your requirements is that the cart number is invalid if:
Which would translate to this code:
<#if record.entity?contains("Company ABC") &&
(record.otherrefnum?contains("SC 100") || record.otherrefnum?contains("SC100") ) &&
record.custbody_scoverride != 'T'>
<table id="table1">
<tr><td>Shopping Cart Number is invalid.</td></tr>
</table>
<#else>
<table id="table2">
<tr><td>${record.otherrefnum}</td></tr></table>
</#if>