Browse By

NetSuite Advanced PDF/HTML Template Guide

NetSuite Advanced PDF/HTML Templates are a vital yet overly complex feature of NetSuite. This guide is meant to help you navigate the creation of custom templates. These templates are used for all types of transactions from sales orders, work orders, picking tickets, and more.

Standard Templates

NetSuite provides standard templates for all the transaction types. These basic templates give you a great starting point and in limited cases work without editing. However, 99% of your templates need to be customized to your business to really be useful.

To get started, click the “customize” link next to the standard template you wish to edit.

Theoretically, you can edit your PDF/HTML in a WYSIWYG (what you see is what you get) method. Unfortunately, one small misstep here and the template gets out of sorts. Instead, click the source code toggle in the top right to get down to business.

Editing Your Templates

Source code looks overwhelming on the first view. NetSuite uses Apache FreeMaker for Advanced PDF/HTML templates. This markup mixes HTML, CSS, and its own “FreeMarker Template Language (FTL), which is a simple, specialized language” to produced robust templates. If you have experience with coding, learning this markup will be pretty easy. If you are new to coding, I hope to help.

Using the standard template, you will see a great deal of markup that generates your template. By editing this code and adding to it, you can improve and enhance your template and ensure it works. You don’t need to create anything from scratch.

The first section of code handles different languages. Most likely you can skip over this. The next section begins with <macrolist>. Each FTL code is like HTML where it has an opening tag and closing tag, i.e. </macrolist>. This area contains your Header and Footer information.

Under the Header, you can add your preferred company logo URL, edit how your address shows, how the transaction name appears, the transaction date, and more. The space is somewhat limited, but here you can add quite a bit of useful information that will appear on the top of your printed template.

The Footer section is like the Header but appears at the bottom of each page. Here you can print page numbers as well as other information, say your company’s website or customer service phone number, etc.

Styling Your Template

The next section contains the styling. NetSuite templates use CSS styling and this is the best place to make cosmetic changes to how your templates will print. You can change fonts, text size, font weight, spacing, etc.

The templates use tables, so much of the styling is for these tables. A table in HTML is a way to position content much like a spreadsheet. You use column spans to enable enough space for the specific fields you are using in your template.

While styling your template, here is where it is a good idea to create specific span styles for fields you are using. Example: span.customer_notes could be used to make larger text to highlight any customer notes. Note that this field would be a custom field, most likely used on your Sales Order Form.

Adding Fields and Other Custom Information

The last section is the body of your template. This is where a large table (or nested tables) holds the information of your template. The table has headers that display field names and rows that show the data from those fields. The markup to call a field (standard or custom) is ${field_name}. Some fields use ${record.field_name}, where the “record” is calling up the current record. Other fields may use other prefixes to call up other data types. Example: ${} or on a sales order, ${} to reference the item on the sales order.

Tip: to get a field name, go to that record and click the heading above the field you want to use.

If you add another field to your table, you need to make sure there is enough space to fit the added column. To do this, simply change the colspan=”x” number to fit accordingly.

Advanced Customization

There are many advanced features you can add to your templates. The use of <#if> statements can let you display content if it is present and ignore it if not. Example:

<#if record.discounttotal?has_content>   Discount ${record.discounttotal} </#if>

If there is no discount or your sales order, this will be skipped over. This is a powerful way to easily highlight important values on your orders: expedited orders, specific shipping instructions, customer notes, etc.

The options are practically endless. If you have a specific feature you need to add to your NetSuite Advanced PDF/HTML Template, feel free to contact me and I can help you out!