Checks if a specified value exists in an array. If the value is found, the main block is rendered; if not, the {{else}} block runs. This helper works only with simple arrays (strings, numbers, etc.), not arrays of objects.
{{#inArray array value}} expressionInitial {{else}} expressionElse {{/inArray}}
-
array (required): the array to search
-
value (required): value to check for
-
Check if a tag exists in an order
{{#inArray record.order.tags "priority"}} Push to Salesforce as high-priority case {{else}} Ignore or send as regular case {{/inArray}}Input:
{ "record": { "order": { "id": 45678, "tags": ["gift", "priority", "international"] } } }Output:
Push to Salesforce as high-priority case
-
Check membership with a missing value
{{#inArray record.order.tags "express"}} Mark as express shipping {{else}} Continue with standard shipping {{/inArray}}Input:
{ "record": { "order": { "tags": ["gift", "priority", "international"] } } }Output:
Continue with standard shipping
-
Strings don't change to numbers
{{#inArray record.numbers "3"}} Found{{else}} Not found{{/inArray}}Input:
{ "record": { "numbers": [1, 2, 3, 4] } }Output:
Not found
Tip
-
Works only with arrays of simple values. For arrays of objects, use the
#filterhelper. -
Matching is case-sensitive:
"Priority"and"priority"are treated as different values. -
Useful for routing, conditional branching, or handling special cases based on tags or labels.
-
Renders the
{{else}}block if the array parameter is not a valid array or if the array contains objects.