Handlebar Helper Function: Hash

Constructs an object from key-value pairs. Use this helper as a subexpression to pass structured data as a named parameter to other functions, such as queryFirst.

This helper is used only as a subexpression within other functions. It can’t be used on its own.

Note

Availability 

This helper is available in the Summer ’26 release of Marketing Cloud Next (API version 67.0).

Syntax 

There are two ways to specify values for this helper. You can specify values by using the equals operator, as in this example:

1(hash key1=value1 key2=value2 ...)

You can also specify values by using positional pairs of keys and values:

1(hash key1 value1 key2 value2 ...)

Return Value 

The function returns a map (LinkedHashMap) that contains all of the specified key-value pairs. The function preserves the order of the key-value pairs.

Usage Examples 

This example creates a simple object that contains literal values.

1{{hash name="Alice" age=30}}

The function returns a simple hashmap object: {name=Alice, age=30}.

Using Variable References 

You can specify variables as key values, as shown in this example:

1{{hash greeting=firstName status="active"}}

The returned object includes the value of the firstName variable for the greeting key.

Using with QueryFirst 

This example uses the hash helper to provide search parameters to the queryFirst helper.

1{{queryfirst type="CRM" object="Account"
2  where="Name LIKE :search"
3  params=(hash search="Acme%")}}

See Also