NetSuite allows you to create custom fields to capture business-specific data (like project codes, VAT numbers, or delivery notes). These fields can also be pulled into your Advanced PDF/HTML templates using FreeMarker.
This page covers how to insert, format, and troubleshoot custom fields in both header (body) and line item sections.
🔹 Understanding Custom Field IDs
- Body (header-level) custom fields → start with
custbody_
- Column (line-level) custom fields → start with
custcol_
- Entity custom fields → start with
custentity_
- Transaction fields on items → accessible within
<#list record.item as i>
🔹 Displaying Custom Body Fields
<p>Project Code: ${record.custbody_project_code!"N/A"}</p>
<p>Customer PO: ${record.custbody_customer_po!"Not Provided"}</p>
✔️ The !"Default Text"
prevents blank outputs.
🔹 Displaying Custom Line Item Fields
Within the item loop:
<table border="1" width="100%">
<tr>
<th>Item</th>
<th>Description</th>
<th>Warranty</th>
<th>Custom Note</th>
</tr>
<#list record.item as i>
<tr>
<td>${i.item}</td>
<td>${i.description}</td>
<td>${i.custcol_warranty_period!"-"}</td>
<td>${i.custcol_custom_note!"N/A"}</td>
</tr>
</#list>
</table>
✔️ ${i.custcol_warranty_period}
pulls a custom column field.
🔹 Conditional Display of Custom Fields
<#if record.custbody_special_instructions?has_content>
<p><b>Special Instructions:</b> ${record.custbody_special_instructions}</p>
</#if>
✔️ Avoids printing a blank line if no value exists.
🔹 Using Labels Instead of Internal IDs
Sometimes custom fields show internal IDs instead of labels. To display the label:
<p>Payment Terms: ${record.terms@label}</p>
<p>Sales Channel: ${record.custbody_sales_channel@label}</p>
✔️ @label
retrieves the display value instead of the ID.
🔹 Formatting Custom Field Values
You can format numbers and dates from custom fields:
<p>Estimated Delivery: ${record.custbody_est_delivery_date?string("MMMM dd, yyyy")}</p>
<p>Custom Amount: ${record.custbody_total_discount?string["#,##0.00"]}</p>
🔹 Example: Custom Header Section
<div style="margin-top:10px; font-size:12px;">
<p>Project Code: ${record.custbody_project_code!"N/A"}</p>
<p>VAT Number: ${record.custbody_vat_number!"Not Available"}</p>
<p>Delivery Instructions: ${record.custbody_delivery_note!"None"}</p>
</div>
✅ Best Practices
- Always use
!"Default"
or?has_content
for cleaner outputs. - Use
@label
to display the readable value. - Test with multiple records — some fields only populate under certain conditions.
- Keep custom field internal IDs consistent across templates.
✅ Summary — What You Learned
By the end of this section, you know how to:
- ✅ Insert custom body fields (
custbody_
). - ✅ Insert custom line fields (
custcol_
) inside item tables. - ✅ Use conditional checks to avoid blank outputs.
- ✅ Display labels instead of raw internal IDs.
- ✅ Format dates and numbers from custom fields.
This prepares you for the next section: Multi-Subsidiary & Multi-Currency PDFs, where you’ll learn to handle different legal entities, tax IDs, and currencies in one template.
Leave a Reply