Advanced PDF/Html Templates – Subsidiary Specific fields

Many records and transactions in NetSuite have associated PDF formats that can be printed. This is most frequently used on externally facing transactions such as Quotes or Invoices. The standard forms in use when you begin using NetSuite are customizable through a visual builder that allows a less experienced developer, with no knowledge of html, to make limited changes.

An example of the visual builder for PDF templates in NetSuite

Once you have stretched the basic layout builder to its limits you will want to switch through to the source and start tinkering with the code. Once you switch to the source code you may not be able to return to the visual layout builder again but you will of course have unlocked the ability to make anything possible! Joking aside the Advanced PDF/Html Templates are very flexible and since the framework has been built using the visual builder, beginner coders have a base to work from rather than having to start from scratch.

Personally, I learnt most of the html I know from analyzing the base templates here in NetSuite and then replicating table formats and other syntax. Hitting preview every minute or two allows you to check the impact of the change you have just made and also validate the code.

The power that this gives you is immense. One of many new abilities is being able to show a data field only IF certain criteria is met. You may be familiar with doing this in a saved search using SQL but for the PDF template you are going to need to use html. Lucky for you I have the answers here so you are not going to have to figure this out through trial and error. What a time to be alive.

Subsidiary specific fields on a PDF template

As the title of this article suggests I am going to run through a very specific example here. This is a scenario that I have experienced recently and thought It would be useful to share. I worked with a client that had the same PDF template for Invoices going out from all their subsidiaries. The only thing they wanted to change was the field label for Tax ID and company registration number in the footer of the page. We established that the simplest and quickest solution was to simply set conditions to show X value when Subsidiary was one thing and Y value when subsidiary was another.

If I want to show the label ‘TAX ID’ when Subsidiary1 is in use and VAT NUMBER when all other Subsidiaries are in use, I will use the following code –

<#if record.subsidiary='Subsidiary1'>TAX ID<#else>VAT NUMBER</#if>

Maybe you want to show no label at all for a specific Subsidiary and specify the label for all others. That scenario would look like this –

<#if record.subsidiary='Subsidiary1'><#else>VAT NUMBER</#if>

Such a simple command but it can be used to add real useful flexibility to your PDF templates.

How else could you use this code?

– A message displayed only for invoices in a certain currency – replace record.subsidiary with record.currency

– Field labels to change depending on currency in use

– Message to display for Invoices over a certain value – replace record.subsidiary with

These are just a couple of examples that may or may not resonate. No doubt, however, at some point in your NetSuite career you will be presented with an issue that this piece of code is going to completely destroy and you will be recognized for the hero that you are.

Dynamic Subsidiary fields on PDF templates

Whilst we are on this subject, there is a really useful and time saving NetSuite default to be aware of. The standard templates in NetSuite all look at the Company Information page for data such as company logo, company name and address. This can be found at Setup > Company > Company Information.

If you are using a NetSuite OneWorld account then that information is likely to be different for all subsidiaries. It makes more sense, therefore, to be looking at the logo, company name and address on the subsidiary record instead. There are no IF conditions or clever html required here. You simply need to change the fields to those on the subsidiary record rather than the company information page. Amend the following fields –

Company InformationSubsidiary Record

You should update these fields on all externally facing PDF templates to avoid any incorrect information being sent to customers or suppliers.

Are you using Inline HTML fields? These are another opportunity to practice your HTML and provide some great visual options to NetSuite forms. Learn how to use Inline HTML here.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *