Handlebars Documents

Contents

About

The Handlebars document allows you to build custom documents. For example, you could build a custom CSV format, or even a KML file. You can also add loops or conditions to control how the document behaves in different scenarios, based on the data in a form submission.

If you are looking to build a custom PDF, Word, or HTML document, use those document types instead; Handlebars can be used to customize the layouts of those documents.

Like all documents in TrueContext, Handlebars documents can be sent to cloud and enterprise services, web services, and more. A number of document types are available, and multiple documents can be sent with a single form submission. Read more about documents here.

Basic Setup

  1. Create the document, and select Handlebars as the document type.

  2. Name the document, and optionally provide a description.

  3. Use a DRELClosed Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms. expression to configure a document Filename. 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.

  4. Choose a Document Timezone source.

    • Team Preference Setting—Displays times using the Team Time Zone. This applies to the shifted time and not the provided time.

    • Form Submission—Displays times using the device time zone.

      Note:The device time zone refers to the device setting, not the user profile locale settings in the TrueContext Mobile App account details.

    • Custom—Choose a time zone. Custom time zones apply to the shifted time and not the provided time.

  5. Optionally auto-link the document to forms.

Template Setup

Data Node Format

This setting changes how the nodes containing question/answer information are named.

Choose one of the following options:

  • Standard—This option provides the form elements in an array that you can loop over. Use this option when you want to apply generic logic to all elements of your form.

  • All Labels as Node Names—Uses the page, section, and answer unique IDs (labels) instead of the generic names.

    Tip:This option gives you precise labels you can use to reference specific nodes in the submitted record. Use this option when you want to place specific answers in specific places in your template output. The examples in this topic all use this setting.

  • Flat Answer List—Changes the hierarchical tree structure into a flat data structure (list). Use this option when you want to loop over answers and don’t need to reference the full form structure (pages, sections, or Repeatable Sections).

File Extension

The document can be any text-based file type (HTML, .txt. .xml, etc). This is the file type the document will create.

Content Type

Leave this blank for automatic resolution based on file extension.

Template

Supply the document body, using Handlebars to reference answers from your form submission. .

Remember to format your template according to the content type; if you want to generate an XML document, be sure to format it correctly in XML.

Info:We recommend that you escape the data to ensure that the system generates the documents in a valid format.