Common Liquid expressions in Workflow

Knowledge Center > Workflow > Using Workflow > Common Liquid expressions in Workflow

Common Liquid expressions in Workflow

You can use the Liquid expressions in this article as a reference for filtering and transforming data in Workflow tasks. For most of the expressions, an output is provided after the => sign.

For the complete documentation about functions, filters, and tags in the Liquid template language, refer to this page

Dates

{{ "now" | date: "%Y-%m-%d" }} 
=> 2017-07-11
{{ "now" | date: "%FT%T%:z" }} 
=> 2017-07-11T02:00:00
{{ "now" | http_date }} 
=> Tue, 11 Jul 2017 06:00:00 GMT
{{ Data.Account.LastInvoiceDate | date_manip: '-', 5, 'day' | date: "%Y-%m-%d" }} 
=> 2017-07-5

Syntax for date_manip:

 date_manip: [['-', '+'], [Integer], ['minute', 'hour', 'day', 'month', 'year']

Money filters

{{ 9099.000909 | money }}
=> 9,099.00
{{ 9099.000909 | money: 'USD' }}
=> $9,099.00
{{ Data.Account.Balance | money: Data.Account.Currency }} 
=> £582.62

Data transforms

{{ Data | to_json }} 
=> JSON dump of the entire data payload.
{{ Data.Account | to_xml }} 
=> XML dump of Account-related data.

Zuora helpers

{{ Credentials.zuora.username }} 
=> The Username of the Workflow instance
{{ Credentials.zuora.password }} 
=> The Password of the Workflow instance
{{ Credentials.zuora.url }} 
=> The SOAP API URL of the Workflow instance
{{ Credentials.zuora.session }} 
=> The Workflow instance session
{{ Credentials.zuora.entity_id }} 
=> The Entity Id of the Workflow instance
{{ Credentials.zuora.rest_endpoint }} 
=> The API URL of the Workflow instance. For example, https://rest.zuora.com/v1/.

Where

{% assign where_condition = Data.Account | where: "AccountNumber", "A00000052"   %}
{{ where_condition[0].Id }}

Output: 2c92c0f84ed8ca02014edc0c8d38405c

Where expression

{% assign where_expression = Data.Account | where_exp: "item", "item.Balance > 100"  %}
{{ where_expression[0].Id }}

Output: 2c92c0f84ed8ca02014edc0c8d3840

Group by

{% assign group_by = Data.Account | group_by: "Currency" %}
{{ group_by | to_json }}

Output:

[{"name":"USD","items":[{"Currency":"USD","AccountNumber":"A00000052"},{"Currency":"USD","AccountNumber":"A00000051"}],"size":2},{"name":"EUR","items":[{"Currency":"EUR","AccountNumber":"A00000050"}],"size":1}]


Group by expression

{% assign where_expression = Data.Account | group_by_exp: "item", "item.AccountNumber 
| slice: 0" %}

Output:

[{"name":"A","items":[{"Currency":"USD","AccountNumber":"A00000050"},{"Currency":"USD","AccountNumber":"A00000052"}], "size": 2},{"name":"Z","items":[{"Currency":"USD","AccountNumber":"Z00000002"}],"size":1}]

Last modified

Tags

Classifications

(not set)