AMS uses FreeMarker for generating text in areas such as email endpoints and document transformations.
FreeMarker is a tool that is used to generate text from templates (not to be confused with an AMS Template).
General information can be found at the project’s website http://freemarker.org/ and a manual is available online here.
When using FreeMarker message data will be available under the ‘messageData’ key, e.g. for a field with external label name it can be inserted into a FreeMarker template using the format:
${messageData.name!}
Note the ‘!’ in the above example. This is optional but it prevents FreeMarker from returning errors when a referenced value is empty (or null).
Errors and Empty Values
FreeMarker templates can be used in the Filename values for documents and the address fields, subject lines and body content for emails.
When using a FreeMarker template for a value within a route if you have not included a Common Data Transformation then data for items such as Date Fields will be Java Date objects and Java Lists for Choice Group Fields. You can use the built in options within FreeMarker for dealing with these types.
Conditional Output
To access values from the message details within a FreeMarker Template use the format:
${messageData.messageDetails.detailItem!} e.g. for the mobile account username: ${messageData.messageDetails.username}
Note that the message details will not be present if they are not set to be included in the route settings.