ANS-0939 · PRINTING, PDF & EMAIL TEMPLATES
How to Use Arithmetic Expressions in NetSuite Scriptable Email Templates?
NetSuite users can enhance their email templates by incorporating basic arithmetic operations directly within FreeMarker expressions, such as scaling item quantities.
Short answer
NetSuite scriptable email templates support arithmetic expressions, allowing for dynamic calculations directly within the template. For instance, you can multiply item quantities by a factor using FreeMarker syntax like ${sublistItem.quantity * 25} within a list loop to display scaled values.
Scenario
NetSuite users often need to display calculated values, such as scaled quantities or adjusted totals, directly within their scriptable email templates. The challenge is to perform these arithmetic operations dynamically without pre-calculating the values in a script or custom field.
Solution
NetSuite scriptable email templates allow for the direct use of arithmetic expressions within FreeMarker syntax. This enables dynamic calculations to be performed and displayed in the email content. For example, to display a scaled quantity for each item in a transaction, the following FreeMarker code can be used:
<#list transaction.item as sublistItem> Quantity: ${sublistItem.quantity}Scaled Quantity: ${sublistItem.quantity * 25} </#list>This example demonstrates how to multiply the sublistItem.quantity by 25 to show a "Scaled Quantity" alongside the original quantity for each item.
Expert NetSuite Support
Need help with this NetSuite issue?
Printing, PDF & Email Templates consulting and configuration support
