Filter and variable reference
The following table lists all of the built-in variables available within the template engine.
| Variable | Description | Example | Output |
|---|---|---|---|
inputType: object | The object from the data pipeline that was passed in from the previously run action. | {{ input.myCsvData }} | ID,Name12345,Alice Jones23456,Bob Smith |
contextType: object | A context object that provides information about the current workflow/run. | ||
context.cloudIdType: string | The current Cloud ID. | {{ context.cloudId }} | SAMPLEIMIS |
context.workflowIdType: string | The current workflow ID. | {{ context.workflowId }} | 01J3N6PPJN2C5D73K4H6KJSQ8D |
context.workflowNameType: string | The current workflow name. | {{ context.workflowName }} | My Sample Workflow |
context.triggerTypeType: string | The current workflow's trigger type. Can be one of: manual, scheduled, or webhook. | {{ context.triggerType }} | manual |
context.runIdType: string | The current run's ID. Guaranteed to be unique across different runs. | {{ context.runId }} | 01J3N6TMFCDYEA1Y4P1P47YZTT |
context.startTimeType: string (datetime) | The timestamp at which the current workflow run started executing. | {{ context.startTime }} | 2024-07-25T15:06:52 |
todayType: string (date) | The current UTC date (only) in ISO-8601 format. | {{ today }} | 2024-07-25 |
nowType: string (datetime) | The current UTC date and time in ISO-8601 format. | {{ now }} | 2024-07-25T15:10:40Z |
date.nowType: datetime | The current UTC date and time, as a datetime object. | {{ date.now }}{{ date.now | format 'dddd' }} | 7/26/2024 1:37:38 PMFriday |
ulidType: string | Generates a new ULID. | {{ ulid }} | 01J3NQGV5SRVNDGBP3393234B4 |
guidType: string | Generates a new GUID / UUIDv4. | {{ guid }} | f68b8bc7-46d7-4a5d-a12f-34fdf08fe6bc |
math.random [min] [maxExclusive]Type: int | Generates a random number between the minimum (inclusive) and maximum (exclusive) numbers specified, each time the template is evaluated. min and max must be less than or equal to 2147483647. | {{ math.random 1 100 }} | 47 |
nilnull | Represents null in a template. nil and null are equal and can be used interchangeably. They both evaluate to the equivalent of C#'s or JavaScript's null. | {{ input.someNullProp }}{{ input.someNullProp == null }} | nullTrue |
Contextual variables
The following table lists all of the built-in variables that are only available to use in certain contexts.
| Filter | Returns | Description | Example |
|---|---|---|---|
itemType: object | Only used within the Select action when you provide an input array. Used to reference the current object when iterating over the array and choosing which properties to map. | {{ item.myProp }} | Sample value |
batchType: object | Only used within the HTTP Request action when you enable batching. Used to add the current batch to the body of the HTTP request. This item is always a JSON array of objects. | {{ batch }} | [ { "id": "123", "text": "Batch Record 1"}, ... ] |
Filters
The following table lists all of the functions (filters) available within the template engine.
| Filter | Returns | Description | Example | Output |
|---|---|---|---|---|
json | string | Converts an object to a JSON string. | {{ ['Hello', 'World'] | json }} | ["Hello","World"] |
jsonf | string | Converts an object to a formatted JSON string. | {{ ['Hello', 'World'] | jsonf }} | [ "Hello", "World"] |
jsonp | object | Parses the string into a JSON object. | {{ '{a:"b",c:2,d:true,e:null}' | jsonp }} | { "a": "b", "c": 2, "d": true, "e": null } |
lengthlencount | int | Strings: Gets the length of the string. Arrays: Gets the count of items in the array. Objects: Gets the count of properties in the object. | {{ 1..100 | count }}{{ "Hello world!" | len }} | 10012 |
upcase | string | Converts a string to upper case. | {{ "Hello world!" | upcase }} | HELLO WORLD! |
downcase | string | Converts a string to lower case. | {{ "Hello world!" | downcase }} | hello world! |
capitalize | string | Capitalizes the first letter of a string. | {{ "hello" | capitalize }} | Hello |
select [string] | any | Selects a property from an object with a complex name. (Properties cannot be dot-indexed if they contain special characters.) | ❌ {{ input.myHttpCall.headers["Cache-Control"] }}✅ {{ input.myHttpCall.headers | select 'Cache-Control' }} | <error>[ "no-cache" ] |
select [string] [string] | any | Selects a property from a dictionary-style array by its key. Includes support for looking inside a $values array from a REST API call. The second parameter is used to define the dictionary key name (usually, key or name or code). | {{ input.dictionary | select "myKey" "key" }} | myDictionaryValue |
get [string] | any | Operates the same as select [string] but does not apply any dictionary checks, and will return the property specified verbatim. | {{ input.myHttp.headers | get 'complex-header' }} | ['array', 'of', 'values']headerValue |
first {count=1} | any | array | Takes the first n items, or takes only the first one if the count is omitted. Works on arrays, objects, and strings. For arrays, when count=1, returns the item by itself, otherwise returns a new array of items. | {{ 0..10 | first }}{{ "Hello world!" | first 5 }} | 0Hello |
last {count=1} | any | array | Takes the last n items, or takes only the last one if the count is omitted. Works on arrays, objects, and strings. For arrays, when count=1, returns the item by itself, otherwise returns a new array of items. | {{ 0..10 | last }}{{ "Hello world!" | last 6 }} | 10world! |
type | string | Gets the type of the input object. Will return one of: string, int, long, float, boolean, datetime, timespan, jobject, jarray, or null. | {{ 'sample' | type }}{{ 47 | type }}{{ ('2024-07-01' | to_date_time - date.now) | type }} | stringinttimespan |
format [string] | string | Formats the input according to .NET formatting rules. Allows you to format numbers, dates, times, etc. For more information, refer to the .NET formatting overview. | {{ 105.3255555555554 | format 'C' }}{{ date.now | format 'dddd MMMM dd, yyyy' }} | $105.33Thursday July 25, 2024 |
to_string | string | Converts the input into a string. If the input is already a string, does nothing. Equivalent to calling .ToString() on the input. | {{ 0.00 | to_string }}{{ true | to_string }} | 0True |
to_int | int | Attempts to convert the input to an integer. Returns 0 if the conversion failed or the input is invalid. | {{ 1.23 | to_int }}{{ "47" | to_int }}{{ 'a' | to_int }} | 1470 |
to_float | float | Attempts to convert the input to a floating point number. Returns 0 if the conversion failed or the input is invalid. | {{ 1.23 | to_float }}{{ "47.12" | to_float }}{{ 'a' | to_float }} | 1.2347.120 |
to_date_time | datetime | Attempts to convert the input into a date/time object. | {{ '1/1' | to_date_time }}{{ '2024-06-01' | to_date_time | format 'dddd' }} | 1/1/2024 12:00:00 AMSaturday |
to_bool {fallback=false} | boolean | Attempts to convert the input to a boolean. Case-insensitive. Accepted truthy values are 1, Y, YES, TRUE. Accepted falsy values are 0, N, NO, FALSE. null is considered false. All other inputs will result in the fallback value being returned, which defaults to false. | {{ 'a' | to_bool }}{{ 'a' | to_bool true }}{{ 'TRUE' | to_bool }}{{ 'Y' | to_bool }}{{ 'N' | to_bool true }} | falsetruetruetruefalse |
to_base64 | string | Converts the input to a Base64-encoded string. | {{ 'Hello Base64!' | to_base64 }} | SGVsbG8gQmFzZTY0IQ== |
from_base64 | string | Converts the input from a Base64-encoded string back into a (UTF-8) string. | {{ 'SGVsbG8gQmFzZTY0IQ==' | from_base64 }} | Hello Base64! |
to_base64_url | string | Converts the input to a Base64-encoded URL safe string. | {{ 'Hello Base64!' | to_base64_url }} | SGVsbG8gQmFzZTY0IQ |
from_base64_url | string | Converts the input from a Base64-encoded URL-safe string back into a (UTF-8) string. | {{ 'SGVsbG8gQmFzZTY0IQ' | from_base64_url }} | Hello Base64! |
keys | jarray | Retrieves a list of the keys present in an object/dictionary. | {{ context | keys }} | ["cloudId", "workflowId", "workflowName", "triggerType", "runId", "startTime"] |
items | jarray | Retrieves a list of the items present on the input object, in key/value format. | {{ context | items }} | [ { "Key": "cloudId", "Value": "XYZIMIS" }, { "Key": "triggerType", "Value": "Manual" }, // ... ] |
isnull [default] | any | Null-coalescing function. Equivalent to IS_NULL() in SQL, or the ?? operator in C#. Returns the default value if the input object is nil or falsy. | {{ fakeVariable | isnull "fallback" }} | fallback |
NoteThis list does not encompass all filters available to the Liquid language. For a full filter reference, please refer to the Liquid filter documentation.
