FreeMarker Data Model
The FreeMarker data model uses a tree structure that's filled with data from NetSuite that matches the context in which a template is being used. Context determines which records you can reference for each type of email.
The NetSuite FreeMarker data model includes the following contexts and their supported records:
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 |
FreeMarker includes 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 can't be written to the email text, but instead they're 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 let you access sublist variables using numbers in square brackets, starting at 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.
Scriptable templates also have extra synthetic fields for each context that you can't get in SuiteScript. For descriptions and a complete list of these fields, see Synthetic Fields for Scriptable Templates.