Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Home/ Advanced PDF Templates in NetSuite/Conditional Logic in Advanced PDF

Conditional Logic in Advanced PDF

Conditional logic lets you control what appears on your NetSuite Advanced PDF templates. Using FreeMarker tags like <#if>, <#elseif>, and <#switch>, you can show or hide fields, format values differently, or display alternate text depending on the record data.

This is powerful for handling multi-subsidiary, multi-currency, or client-specific layouts.


πŸ”Ή Basic <#if> Condition

<#if record.status == "Paid">
   <p><b>Thank you for your payment!</b></p>
</#if>

βœ”οΈ Shows the message only if the transaction is paid.


πŸ”Ή <#if> / <#else> Example

<#if record.terms?has_content>
   <p>Payment Terms: ${record.terms}</p>
<#else>
   <p>No Payment Terms Assigned</p>
</#if>

βœ”οΈ Prevents empty sections when no value exists.


πŸ”Ή Checking Numeric Values

<#if record.total > 1000>
   <p><b>High Value Transaction</b></p>
</#if>

βœ”οΈ Only triggers if invoice total is greater than 1000.


πŸ”Ή Using <#elseif> for Multiple Cases

<#if record.subsidiary == "1">
   <p>Bank: HSBC London</p>
<#elseif record.subsidiary == "2">
   <p>Bank: RBC Toronto</p>
<#else>
   <p>Bank: Default Account</p>
</#if>

βœ”οΈ Useful for multi-subsidiary bank accounts.


πŸ”Ή Checking if a Field Has Value

<#if record.custbody_project_code?has_content>
   <p>Project Code: ${record.custbody_project_code}</p>
</#if>

βœ”οΈ ?has_content ensures the field is not blank before displaying.


πŸ”Ή Using <#switch> for Cleaner Logic

<#switch record.currency>
   <#case "USD">
      <p>Currency: US Dollar</p>
      <#break>
   <#case "CAD">
      <p>Currency: Canadian Dollar</p>
      <#break>
   <#default>
      <p>Currency: ${record.currency}</p>
</#switch>

βœ”οΈ Best when handling multiple options (like currencies or shipping methods).


πŸ”Ή Conditional Logic in Line Items

<#list record.item as i>
   <tr>
      <td>${i.item}</td>
      <td>
         <#if i.quantity > 10>
            Bulk Order
         <#else>
            Standard Order
         </#if>
      </td>
   </tr>
</#list>

βœ”οΈ Dynamically labels orders based on quantity.


πŸ”Ή Example: EU VAT Display

<#if record.shipcountry == "DE" || record.shipcountry == "FR" || record.shipcountry == "IT">
   <p>VAT Number: ${record.custbody_vatnumber!"N/A"}</p>
</#if>

βœ”οΈ Shows VAT only for EU shipping countries.


βœ… Best Practices

  • Always use ?has_content to avoid printing blank values.
  • For multi-subsidiary setups, use <#switch> to manage cleaner logic.
  • Combine logic with CSS for conditional formatting (like highlighting overdue invoices).
  • Test with multiple records to confirm correct behavior.

βœ… Summary β€” What You Learned

By the end of this section, you now know:

  • βœ… How to use <#if>, <#else>, and <#elseif> for conditions.
  • βœ… How to check numeric and text field values.
  • βœ… How to use <#switch> for multi-option handling.
  • βœ… How to apply conditional logic inside line items.
  • βœ… Practical business cases (multi-subsidiary bank accounts, EU VAT, bulk orders).

This builds the foundation for the next topic: Tables & Line Item Formatting, where you’ll learn to style, group, and subtotal line items.

πŸ“– Official Resource: Learn more in the NetSuite Advanced PDF/HTML Templates Guide on Oracle Docs.

Share
  • Facebook

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 6
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuite’s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 22 Points
Begginer
Sophie1022

Sophie1022

  • 0 Questions
  • 20 Points
Begginer
jmargoli

jmargoli

  • 0 Questions
  • 20 Points
Begginer

Trending Tags

clientscript netsuite scripting suitescript
  • NetSuite Error Messages: Causes and FixesAugust 11, 2026
  • How to audit every SuiteScript 1.0 script in your NetSuite account (step by step)August 11, 2026
  • SuiteScript 1.0 vs 2.1: a plain-English comparison for NetSuite adminsAugust 10, 2026
  • What NetSuite 2026.2 actually changed β€” the deprecation warnings explainedAugust 9, 2026
  • The 2027.1 NLAuth deadline: why your NetSuite RESTlets are at immediate riskAugust 8, 2026
  • NetSuite is deprecating SuiteScript 1.0 β€” here’s what it means for your businessAugust 7, 2026
  • SuiteScript 1.0 Is Being Phased Out: What It Means and How to PrepareJuly 24, 2026
  • A Practical Guide to SuiteScript Modules (With Real-World Examples)July 16, 2026
  • Scaling NetSuite Automation: Scheduled and Map/Reduce Scripts (With a Real Example)July 15, 2026
  • SuiteScript Module Basics: User Event and Client Scripts (With a Real Example)July 15, 2026

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Menu

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us

Quick Links

  • NetSuite Scripting
  • NetSuite Customization
  • NetSuite Advanced PDF Template
  • NetSuite Integration
  • NetSuite Reporting & Analytics

Subscribe for NetSuite Insights....

Β© 2026 The NetSuite Pro. All Rights Reserved