Resolving the ?upper_case Issue in Advanced PDF Templates

Advanced PDF templates often rely on FreeMarker expressions to dynamically format and display data. One common challenge developers face is ensuring that address fields or other dynamic content are properly transformed to uppercase while preserving special characters and XML compatibility. This article explores the issue with the ?upper_case directive and presents a robust solution The… Continue reading Resolving the ?upper_case Issue in Advanced PDF Templates

Advanced PDF/HTML Template code for COO Calculation and Grouped Item Display in NetSuite PDFs

Key Functions: Item Processing: Parses transaction line items, skipping kit/group children to avoid duplication. Handles both item groups and kit structures properly. Amount Normalization: Converts formatted amount strings into usable numeric values (e.g., handling commas, decimals, symbols). COO Assignment: Calculates _computedCOO for each item using: custcolcountry_of_origin (if available), Previous COO for discount items, Defaults to… Continue reading Advanced PDF/HTML Template code for COO Calculation and Grouped Item Display in NetSuite PDFs

Adding a Currency Symbol to an Advanced Template Field

We can use a FreeMarker expression to add a currency symbol on an advanced template. To add a currency symbol to an advanced template: In the template editor, position the cursor in front of the field that represents a currency amount. Enter ${record.currencysymbol} in front of the field label shown on the template: Removing a Currency Symbol… Continue reading Adding a Currency Symbol to an Advanced Template Field

Creating a Footer Section in an Advanced PDF Template with an Email Button

A footer section in a PDF template is a great way to include interactive options, such as a button to send an email directly. <!– Footer Section –> <div class=”footer”> <p>© 2025 Company Name. All rights reserved.</p> <a href=”mailto:support@company.com” class=”email-button”>Email Us</a> </div> This example contains: Copyright Information: Shows ownership of the content. Email Button: Links… Continue reading Creating a Footer Section in an Advanced PDF Template with an Email Button

Handling Complex Record Objects in NetSuite Advanced PDF Templates

In NetSuite, Advanced PDF templates use FreeMarker to generate custom documents. When working with complex records, you may encounter issues where the object seems to have content but doesn’t render as expected. This article covers troubleshooting and handling complex record objects in FreeMarker templates. Diagnosing the Problem Check if the Record is Null: Use the… Continue reading Handling Complex Record Objects in NetSuite Advanced PDF Templates

Substring till a blank space in advanced HTML/PDF template

If the field value we receive is “998529 Other security services nowhere else classified,” but we only want the first token up to the space (998529 ), we can use Advanced Printing’s built-in “substring” and “index_of” functions. Sample code: <#if item.custcol_in_hsn_code?has_content>       <#assign hsn_code = item.custcol_in_hsn_code?substring(0, item.custcol_in_hsn_code?index_of(” “))>     <#else>    … Continue reading Substring till a blank space in advanced HTML/PDF template

Lexical error in Advanced PDF Templates

a lexical error generally refers to an issue with the syntax or structure of code. In the context of a PDF template, especially in systems like NetSuite that use template languages (e.g., FreeMarker), this can occur when there is an invalid token, character, or improperly written expression in the template. Such errors could arise from:… Continue reading Lexical error in Advanced PDF Templates

Date Formatting in NetSuite Advanced PDF/HTML Template

Mismatch or misconfiguration in the date formatting logic in NetSuite Advanced PDF/HTML Template can occur due to various reasons. First reason can be because the date value maybe passed as a string which causes error in formatting. Secondly, for some formats, the Julian day maybe calculated instead of the day of the month or other… Continue reading Date Formatting in NetSuite Advanced PDF/HTML Template

Fixing Stretched Letters in Tables

Understanding the Issue: When creating NetSuite PDFs, you may encounter a common problem where the text within table cells becomes stretched or uneven. This occurs due to the default justification behavior of NetSuite’s BFO (BFO Framework) rendering engine. The Solution: Overriding Default Justification To prevent text stretching and ensure a clean, consistent appearance, we need… Continue reading Fixing Stretched Letters in Tables

Using Advanced Template Formatting Programmatically

Using Advanced Template Formatting programmatically in SuiteScript, specifically for generating custom PDFs and other documents in NetSuite, requires leveraging the SuiteScript 2.0 API and Advanced PDF/HTML Templates functionality. The process generally involves integrating XML-based template structures with data from NetSuite records. Create a new template, or customize an existing one by writing XML-based HTML to… Continue reading Using Advanced Template Formatting Programmatically