FreeMarker Logic and Advanced PDF/HTML Templates with NetSuite

By - February 2, 2016

NetSuite’s Advanced PDF/HTML templates truly empower users with endless options for customizations to printed forms, with the support of FreeMarker. FreeMarker or FreeMarker Template Language (FTL) is an open source Java-based template engine that is used to dynamically render text output in various formats, by providing template processing capabilities and an API that lets users extend or modify FreeMarker’s behavior.

For example, a user has a business requirement to suppress any zero dollar amounts that would appear on an invoice. With the standard PDF templates, this requirement would not be possible. However, with the Advanced PDF/HTML templates, this requirement can easily be achieved by utilizing FreeMarker’s conditional logic.

Here is how this requirement can be achieved:

  • Navigate to your Advanced PDF/HTML Invoice Template.
    • Go to Customization > Forms > Advanced PDF/HTML Templates.
    • Open the invoice template in edit mode and click on the “Source Code” button to view the template’s source code (see below).

p1

  • Find the code that outputs the line item amount on the invoice template.

p2

  • Alter the code to reflect an “if” statement to ultimately suppress the amount if it equals zero.

p3

  • Save the template and print an invoice transaction. Below you will see the before and after effect of adding in the custom FreeMarker conditional logic to the source code of the invoice template.

Before:

p4

After:

p5

For more information on customizing your Advanced PDF/HTML Templates, please contact RSM at erp@rsmus.com or by phone at 855.437.7202.

By: Chris Corral – Illinois NetSuite Solution Provider

Receive Posts by Email

Subscribe and receive notifications of new posts by email.