Handlebars in OL Connect

Handlebars is the name of a JavaScript library that implements a templating language (see https://handlebarsjs.com/). It uses a template and an input object to generate output.

The template looks like regular text with embedded Handlebars expressions. A handlebars expression is some contents enclosed by double curly braces: {{ ... }}. For example:
<p>Hello {{firstname}}!</p>

When the template is rendered, these expressions are replaced with values from an input object.

The Handlebars library is integrated in OL Connect Designer. This means that you can use Handlebars expressions in all sections (as of version 2022.2), as well as in a special type of snippets called "Handlebars templates" (as of version 2022.1).

  • Expressions in sections are resolved using the current record with which a template is merged. In other words, the input object is the current record.

  • Expressions in a Dynamic Table are resolved using the detail record associated with the closest table row. (Nested tables are supported, so a single dynamic table can use multiple detail tables.)

  • In the case of Handlebars templates (snippets), you determine in a script with which data the snippet will be merged. See Handlebars templates for instructions.

Handlebars templates can in turn use other Handlebars templates as snippets. They are called partials. How this works is explained in the topic: Partials.

More about expressions and the functions that you can use in expressions can be found in the topics Handlebars expressions and Using functions in expressions: Helpers.

Note: The information in this Online Help focuses on the implementation of Handlebars in OL Connect. For general information about Handlebars and how to use it, see the following web sites: https://handlebarsjs.com/ and https://devdocs.io/handlebars.