FreeMarker Data Model
The FreeMarker data model uses a tree structure that is populated with data from NetSuite that respects the context in which a template is being used. Context determines the records that can be referenced for a certain type of email.
The following contexts (and their supported records) are included in the NetSuite FreeMarker data model:
Context (Email Type) |
Supported Records |
---|---|
Campaign and Sales Campaign Email |
entity (either customer, contact, vendor, partner, or employee), parent company (if recipient is a contact), campaign event (couponCode field only) |
Support Case Notification |
case, customer |
Customer Issue Notification |
issue, case |
Employee Issue Notification |
issue |
Online Form Notification |
customer, online customer form (name field only) |
Login Access Notification |
entity |
Marketing Subscriptions Opt-In Email |
entity, subsidiary (mainaddress, name, edition, showsubsidiaryname, shippingaddress, federalidnumber, and returnaddress fields only) |
Web Site Digital Delivery Notifications |
|
Web Site Order Notifications |
|
Web Site Other Notifications |
web site, customer |
With FreeMarker, there are three types of nodes (or points where data is linked):
-
scalars – Usually, these include field values from NetSuite records. Scalars can include data in all of NetSuite’s supported field types. For example, the Email field on a contact record is a scalar.
-
hashes – These are variables that act as directories. Typically, these refer to records and sublists in NetSuite. Hashes cannot be written to the email text, but instead are used to look up fields (scalars) using dot notation. For example, the customer record is a hash.
-
sequences – These are containers that store a list of variables. In NetSuite, these are used to return variables from sublists. Sequences refer to variables within sublists through numbers enclosed in square brackets, beginning with 0. For example, the list of contacts on the Contacts subtab of the customer record is a sequence.
You can also use include directives to reference subtemplates that you use.
Scriptable templates use the same record, field, and sublist IDs that are used in SuiteScript. Refer to the SuiteScript Records Browser for a complete list of these IDs. You can use camel case or lower case in FreeMarker code.
There are additional synthetic fields that are not available for SuiteScript that are available in scriptable templates for each context. For descriptions and a complete list of these fields, see Synthetic Fields for Scriptable Templates.