Handlebars

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration - and Onify supports this.

Full documentation to handlebars can be found at handlebarsjs.com.

Where do we support handlebars?

  • Forms (title, description, webhook.*, notification.*, agenttask.*, process.*, meta.*)
  • Bulletins (title, description, action.*)
  • Workspaces (title, description, query, fields.*, help.*)
  • Dashboards (title, description)
  • Guides (title, description)
  • Shortcuts (title, description, link)

Handlebars helpers

These handlebars functions can be used in form configuration, like this: {{toUpperCase submit.username}}. These helpers are case sensitive. Please also see block expressions: https://handlebarsjs.com/guide/block-helpers.html.

  • toUpperCase
  • toLowerCase
  • getArrayValue
  • list - Creates a HTML list from an array
  • csv - Creates a string from an array and separate via comma (,)
  • array
  • stringMatch
  • buildArray
  • checkArrayValue
  • stringify - Creates a string from a json object
  • escapeParameterString - Escapes ' and " chars from string
  • ternary - Conditional operator (condition ? exprIfTrue : exprIfFalse)
  • replace - Replace value in string
  • base64 - Encode/decode Base64 string
  • includes - Check if array includes specific value (block helper)

Example: Use checkArrayValue to see if user has specific role

{{checkArrayValue user.role 'admin' '1' '0'}}

Example: Use ternary to check if variable contains value or not

{{ternary user.settings.locale "Yes" "No"}}
{{ternary user.settings.locale user.settings.locale user.custom.locale}}

Example: Replaces "C" with "c" in string

{{replace "ABC" "C" "c"}}

Example: Encode string to base64

{{base64 "encode" "This is a test string"}}

Example: Decode base64 string

{{base64 "decode" "VGhpcyBpcyBhIHRlc3Qgc3RyaW5n"}}