NetSuite transactions (Invoices, Sales Orders, Purchase Orders, etc.) contain standard fields (like tranid
, trandate
, entity
) and custom fields (defined by your business). With Advanced PDF, you can use FreeMarker syntax to insert these fields into your templates.
This page covers how to display, format, and troubleshoot transaction fields in your Advanced PDF/HTML templates.
🔹 Displaying Standard Fields
<p>Invoice #: ${record.tranid}</p>
<p>Date: ${record.trandate?string("MMMM dd, yyyy")}</p>
<p>Customer: ${record.entity}</p>
<p>Status: ${record.status}</p>
<p>Total: ${record.total}</p>
✔️ record
= transaction record object
✔️ ?string()
= formats dates
🔹 Displaying Custom Fields
Custom fields start with custbody_
(body) or custcol_
(line).
<p>Project Code: ${record.custbody_project_code!"N/A"}</p>
<p>Sales Channel: ${record.custbody_sales_channel}</p>
✔️ Add !"Default"
to avoid blank values.
🔹 Handling Addresses
<h4>Billing Address</h4>
<p>${record.billaddress}</p>
<h4>Shipping Address</h4>
<p>${record.shipaddress}</p>
✔️ These render multi-line addresses automatically.
🔹 Accessing Line Item Fields
<table border="1" width="100%">
<tr>
<th>Item</th><th>Description</th><th>Quantity</th><th>Rate</th><th>Amount</th>
</tr>
<#list record.item as i>
<tr>
<td>${i.item}</td>
<td>${i.description}</td>
<td>${i.quantity}</td>
<td>${i.rate?string["#,##0.00"]}</td>
<td>${i.amount?string["#,##0.00"]}</td>
</tr>
</#list>
</table>
✔️ ${i.item}
= Item name
✔️ ${i.custcol_custom_field}
= custom column field
🔹 Conditional Logic with Fields
<#if record.terms?has_content>
<p>Payment Terms: ${record.terms}</p>
</#if>
✔️ Prevents blank labels when no value exists.
🔹 Example: Transaction Header Section
<div style="font-size:14px; font-weight:bold;">
Invoice #: ${record.tranid}
</div>
<div>Date: ${record.trandate?string("dd-MMM-yyyy")}</div>
<div>Customer: ${record.entity}</div>
<div>Currency: ${record.currency}</div>
<div>Sales Rep: ${record.salesrep!"Not Assigned"}</div>
🔹 Troubleshooting Field Issues
- Blank values → use
!"Default"
- Custom field missing → check form access/permissions
- Wrong format → use
?string()
- IDs instead of labels → use
@label
Example:
<p>Terms: ${record.terms@label}</p>
✅ Summary — What You Learned
By the end of this page, you now know:
- ✅ How to insert standard fields like
tranid
,trandate
,entity
, andtotal
. - ✅ How to display custom body and line fields (
custbody_
andcustcol_
). - ✅ How to render addresses directly with
${record.billaddress}
and${record.shipaddress}
. - ✅ How to loop through line items using
<#list record.item as i>
. - ✅ How to apply conditional logic with
<#if>
to prevent blank fields. - ✅ How to troubleshoot common issues (empty fields, wrong format, ID vs. label).
This gives you a strong foundation to move on to Conditional Logic in Advanced PDF where you’ll apply more complex <#if>
and <#switch>
rules.
Leave a Reply