FreeMarker Documents

This topic describes the basics of how to set up a TrueContext FreeMarker text document.

Info:For help with Apache FreeMarker™ syntax and other FreeMarker Template Language (FTL) details, refer to the FreeMarker Documentation.

Available on the Advanced and Enterprise tiers:



With FreeMarker you can:

  • Generate your own HTML, XML or JSON structure, or any other text-format that suits your needs
  • Use loops and conditional sections
  • Create and change variables within a template
  • Use complex expressions: string operations, calculations, arrays, etc.

A number of other document types are available, and multiple documents can be sent with a single form submission. Read more about documents here.


Create the document, select FreeMarker as the document type,  then follow the instructions below.

Freemarker option on the Create Document page

Document Basics


Give the document a unique name. Optionally provide a description.


This name applies to all instances of the document, including downloaded documents and documents sent by Data Destinations.

Tip:A recognizable file name can help you quickly search for and identify files when:
  • You download files from multiple form submissions so that you can work locally.

  • You or your customers receive multiple messages generated by Email Destinations.

  • Use Data Reference Expression Language to reference answers in your forms.
  • Static text can also be included.
  • For example, %r -- %a[Customer Name] would name the file like "20140812-180001002 -- John Smith."


  • Some data destinations will overwrite files with duplicate names. Make sure file names are unique by including one or more of:
    • %r - the submission's reference number -- e.g. 20140920-1815562464
    • %r[id] - the submission's ID - e.g. 1815562464
    • %t - the time the form was submitted

Document Timezone Source

Choose a document time zone source. This is the time zone for all dates and times in your document.

  • Team Preference Setting: Will use the time zone chosen for the team
  • Data Record: Will use the time zone the form submission is made from (as chosen on the mobile device).
  • Custom: Choose a time zone.


Auto-Link new forms to this document

Selecting this option will add the document as an "Additional Document" to forms created or imported after this option is set. Submissions made against these forms will be downloadable in this document format from the "Data" tab of the portal.



File Extension

The document can be any file type. Most commonly-used file extensions are .txt and .xml.

Content Type

Leave this blank for automatic resolution based on file extension.

FreeMarker Template

Upload your FreeMarker Template in an FTL format.

When set up is complete, press "Create." Link the document to a form in order to use it.

"Create" and "Cancel" an event document

Info:We recommend that you escape the data for all JSON, XML, HTML, and CSV documents. This ensures that the system generates a valid document in your selected format.