Skip to content

Handlebars Reference

Quick reference for all built-in Handlebars helpers available in Send Workbench document templates.

Date formatting

Basic date format

{{dateFormat risk.inceptionDate "dd/MM/yyyy"}}
{{dateFormat risk.expiryDate "MM/dd/yyyy"}}
{{dateFormat risk.inceptionDate "d MMMM yyyy"}}

Common format patterns:

Pattern Example output
dd/MM/yyyy 15/03/2025
MM/dd/yyyy 03/15/2025
d MMMM yyyy 15 March 2025
yyyy-MM-dd 2025-03-15

Today's date

{{now}}

Outputs today's date (the date the document was generated) in the default format.


Number formatting

Currency

{{numberFormat achievedPrice "currency" "en_US" minimumFractionDigits=2 maximumFractionDigits=2}}
{{numberFormat premium "currency" "en_GB" minimumFractionDigits=0 maximumFractionDigits=0}}

Integer

{{numberFormat limit "integer" "en_US"}}

Percentage

{{numberFormat commissionPercentage "percent" "en_US" minimumFractionDigits=2 maximumFractionDigits=2}}
{{numberFormat rate "#0'%'" "en_US" roundingMode=HALF_UP}}

Conditional helpers

#if

Renders the block if the value is truthy (boolean true or a non-empty string):

{{#if risk.umr}}
  <p>UMR: {{risk.umr}}</p>
{{/if}}

#eq

Renders the block if two values are equal:

{{#eq risk.riskType "NEW"}}
  <p>This is a new risk.</p>
{{/eq}}

{{#eq risk.placingType "OPEN_MARKET"}}
  <p>Open Market risk</p>
{{/eq}}

#neq

Renders the block if two values are not equal. Useful for null or blank checks:

{{#neq risk.umr null}}
  <p>UMR: {{risk.umr}}</p>
{{/neq}}

{{#neq risk.brokerParty.displayName ""}}
  <p>Broker: {{risk.brokerParty.displayName}}</p>
{{/neq}}

#each

Standard Mustache loop for iterating over arrays:

{{#each policyGroup.policies}}
  <tr>
    <td>{{optionName}}</td>
    <td>{{machinePrice}}</td>
  </tr>
{{/each}}

Filtering helpers

filterLoop

Filters an array by a field value and iterates over matching items:

{{#each (filterLoop document_creation.FORM "subCategory" "sc_clause_one") }}
  <p>{{code}}{{title}}</p>
{{/each}}

Arguments: filterLoop {array} {fieldName} {matchValue}


Raw HTML output

When a field contains raw HTML that should be rendered (not escaped), use triple braces:

{{{formattedHtmlString}}}

This is primarily used for the OTHER clause category, which contains user-formatted HTML content.


Tips

  • If a value renders as blank, the path is wrong. Use the Swagger endpoint GET /v2/risks/{id} to inspect the actual risk JSON structure and confirm the path.
  • Helpers are case-sensitive. dateFormat is not the same as DateFormat.
  • Nested paths use dot notation: {{risk.insuredParty.company.displayName}}
  • Array index access: {{policyGroup.policies.0.machinePrice}} (zero-indexed)