Using FreeMarker to Work with Hidden Fields Used in Advanced Templates
Advanced printing templates can fail to print when they depend on a sublist hidden field.
In the following custom transaction form example, the Show box beside the Corporate Card field box is not checked. Therefore, Corporate Card is hidden from templates.

When a field is visible (box is checked), it is represented as a Boolean condition in the advanced template, like this:
<#if expense.corporatecreditcard == true>
"Corporate Card" is checked!
</#if>
When a field is hidden, you must instead compare the value of the field with a string: "T"(true) or "F"(false), like this:
<#if expense.corparatecreditcard == "T">
"Corporate Card" is checked!
</#if>
A template that depends on the Corporate Card hidden field is no longer valid because the type of box changes from Boolean condition to string. You cannot compare a Boolean condition to a string.
If you use a string condition like the preceding example and then make the field visible, then this condition is not valid.
Error Messages
If a template cannot be printed because it depends on a sublist hidden field, you receive an error message similar to one of the following:
-
In this example from the template editor, the comparison of string with Boolean condition is not valid:
-
In the following example, the second condition is not valid because it cannot be evaluated to true or false:
Template Editor Error Message
UI Error Message
Solution for Unknown Visibility of the Field
You should avoid a scenario where a template depends on a sublist hidden field.
If you do not know whether the field is visible, you should create a condition in which the template behaves correctly in both cases, like in the following example.
<#if (expense.corporatecreditcard?is_boolean && expense.corporatecreditcard) || (expense.corporatecreditcard?is_string && expense.corporatecreditcard == "T")>
"Corporate Card" is checked!
</#if>
Related Topics
- Source Code Editing in the Template Editor
- Source Code Editing to Customize Advanced Templates
- Syntax for Advanced Template Fields
- Setting a Template to Use a Font Unavailable in NetSuite
- Languages for Printed Forms that Use Advanced Templates
- Adding Translated Content in Advanced Printouts
- Adding Striping to Line Items in Advanced Templates
- Adding Page Breaks to Tables
- Printing Subsidiary Logo on Advanced Templates
- Adding Apply Sublist to Check Templates
- Adding Bar Codes in Advanced Templates