List of supported handlebars helpers that can be used in a template to format data or add conditions on the data passed in workflow trigger.
" "
, null
, undefined
.
Returns:
- Variable value if the variable value is present. For instance, the above example with data
{"name":"Joe"}
will returnJoe
- Default value if variable value is in
" "
,null
,undefined
. For instance, the above example with data{"name":""}
,{"name":null}
or{"city":"Bangalore"}
will returnuser
Returns:Supported Conditional operators in compare statement:
- Returns if the condition inside compare statement returns truthy value. For instance, the above example with data
{"candidate_count":1}
will returnis
- Returns (in case else statement is present) if the condition inside compare statement returns falsy value. For instance, Example-1 with data
{"candidate_count":3}
will returnare
- or Returns if the else statement is not present. For instance, Example-2 with data
{"candidate_count":3}
will not return anything
Operator | Returns truthy when | Sample Statement |
---|---|---|
== | LHS equals RHS | 1 == “1” |
=== | LHS value as well as data type matches with RHS | 1 === 1 |
> | LHS is greater than RHS | 2 > 1 |
\< | LHS is less than RHS | 1 \< 2 |
>= | LHS is greater than equals to RHS | 2 >= 2 or 3 >= 2 |
\<= | LHS is less than equal to RHS | 2 \<= 2 or 1 \<= 2 |
!= | LHS is not equal RHS | 3 != 1 |
!== | LHS value or data type does not equal RHS | 1 !== “1” |
{{default place.city "San Francisco"}}
will return "San Francisco"
only if place
key is present, that is {"place":[]}
if
condition to check if the parent is present and if so, then render nested objects value. Refer below example:
Returns: Above example for below mock data will return steve Olivia
parameter | Obligation | description |
---|---|---|
variable | mandatory | should be a date or timestamp. It will throw an error for invalid date format. To get today’s date (date on which template is getting rendered) you can use "now" string. |
format string | mandatory | date string defining the format in which date should be printed. See all formatting options here. e.g. “dddd, MMMM Do YYYY, h:mm:ss a” will return datetime as “Sunday, February 14 2010, 3:25:50 PM” |
timezone | optional | you can add timezone as a third parameter to convert time in a given timezone. See the list of all possible timezones here |
Example | Output |
---|---|
{{datetime-format date "ddd, MMM Do YYYY, h:mm:ss a"}} | Tue, Sep 26th 2023, 12:00:00 am |
{{datetime-format date "[Today is] dddd"}} | Today is Tuesday |
{{datetime-format date "Do MMMM, YYYY" "America/Chicago"}} | 25th September, 2023 |
Example | Output |
---|---|
{{jsonStringify this}} | \{"likes":3,"comments":4,"users":\["Olivia","Steve"]} |
{{jsonStringify users}} | \["Olivia","Steve"] |
''
is returned.
''
is returned.
''
is returned.
Example | Output |
---|---|
{{add 9 4}} | 13 |
{{add likes comments}} | 7 |
Example | Output |
---|---|
{{subtract 9 4}} | 5 |
{{subtract likes 1}} | 2 |
Example | Output |
---|---|
{{multiply 9 4}} | 36 |
{{multiply ARR billing_months}} | 3600 |
Example | Output |
---|---|
{{divide 14 4}} | 3.5 |
{{divide total_bill billing_months}} | 300 |
Example | Output |
---|---|
{{round 12.5}} | 13 |
{{round (divide 15 4)}} | 4 |
Example | Output |
---|---|
{{mod 14 4}} | 2 |
{{mod total_bill billing_months}} | 0 |
parameter | description |
---|---|
variable | should be an array. If not helper function will throw an error. |
key_string | mandatory only if items in the array are objects. If a unique operation needs to be performed on nested objects, then object notation (a.b or a[‘b’]) can be used. |
Example | Output |
---|---|
{{unique email }} | joe@abc.com, steve@abc.com |
{{unique array "city" }} | San Francisco, Austin |
{{unique personal_details "name.first_name" }} | john, mike |
liked by Mike and 3 others
.
Parameter | Description |
---|---|
variable | should be an array else the helper function will throw an error. |
index | should be an integer else the helper function will throw an error. |
Example | Output |
---|---|
{{itemAt email 1}} | steve@abc.com |
{{itemAt (unique array "city") 0}}
in above mock will return San Francisco
.Parameter | Description |
---|---|
variable | should be an array and items in the array should be of primitive data types like string, number, etc, else the helper function will throw an error. |
separator | should be string else by default separator , will be used. If not provided , is used. |
Example | Output |
---|---|
{{join email }} | joe@abc.com , steve@abc.com , joe@abc.com |
{{join email ' - '}} | joe@abc.com - steve@abc.com - joe@abc.com |
{{join (unique array "city")}}
in above mock will return San Francisco, Austin
your post has got 100 likes
.
Property | Description |
---|---|
variable | should be an array or string to get the actual count of items in the variable provided, else it returns 0. |
Example | Output |
---|---|
{{length array}} | 3 |
{{length name}} | 6 |
{{length active}} | 0 |