ANS-1457 · PRINTING, PDF & EMAIL TEMPLATES
How to Properly Comment Out FreeMarker Code in NetSuite Advanced PDF/HTML Templates
Users often encounter unexpected code execution in NetSuite Advanced PDF/HTML Templates when using standard HTML comment syntax, requiring the specific FreeMarker comment notation for proper functionality.
Short answer
To correctly comment out FreeMarker code within NetSuite Advanced PDF/HTML Templates, the specific FreeMarker comment notation <#-- --> must be used. Standard HTML comment tags <!-- --> will not prevent FreeMarker directives from executing, as the FreeMarker engine processes the template before it is rendered as HTML.
Scenario
When working with NetSuite Advanced PDF/HTML Templates, users may attempt to comment out FreeMarker code using standard HTML comment syntax (). Despite these comments, the FreeMarker code continues to execute, leading to unexpected output or behavior in the generated PDF. This occurs because the FreeMarker engine processes the template before HTML rendering, and it does not recognize HTML comments as a way to disable its own directives.
Solution
To properly comment out FreeMarker code within NetSuite Advanced PDF/HTML Templates and prevent its execution, the specific FreeMarker comment notation must be employed.The correct syntax for commenting out FreeMarker code is:
<#-- -->This notation ensures that the FreeMarker engine recognizes the commented section and skips its processing, effectively disabling the code within the template.
Expert NetSuite Support
Need help with this NetSuite issue?
Printing, PDF & Email Templates consulting and configuration support
