Filter and variable reference

The following table lists all of the built-in variables available within the template engine.

VariableDescriptionExampleOutput
input
Type: object
The object from the data pipeline that was passed in from the previously run action.{{ input.myCsvData }}ID,Name
12345,Alice Jones
23456,Bob Smith
context
Type: object
A context object that provides information about the current workflow/run.
context.cloudId
Type: string
The current Cloud ID.{{ context.cloudId }}SAMPLEIMIS
context.workflowId
Type: string
The current workflow ID.{{ context.workflowId }}01J3N6PPJN2C5D73K4H6KJSQ8D
context.workflowName
Type: string
The current workflow name.{{ context.workflowName }}My Sample Workflow
context.triggerType
Type: string
The current workflow's trigger type. Can be one of: manual, scheduled, or webhook.{{ context.triggerType }}manual
context.runId
Type: string
The current run's ID. Guaranteed to be unique across different runs.{{ context.runId }}01J3N6TMFCDYEA1Y4P1P47YZTT
context.startTime
Type: string (datetime)
The timestamp at which the current workflow run started executing.{{ context.startTime }}2024-07-25T15:06:52
today
Type: string (date)
The current UTC date (only) in ISO-8601 format.{{ today }}2024-07-25
now
Type: string (datetime)
The current UTC date and time in ISO-8601 format.{{ now }}2024-07-25T15:10:40Z
date.now
Type: datetime
The current UTC date and time, as a datetime object.{{ date.now }}
{{ date.now | format 'dddd' }}
7/26/2024 1:37:38 PM
Friday
ulid
Type: string
Generates a new ULID.{{ ulid }}01J3NQGV5SRVNDGBP3393234B4
guid
Type: 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
nil
null
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 }}
null
True

Contextual variables

The following table lists all of the built-in variables that are only available to use in certain contexts.

FilterReturnsDescriptionExample
item
Type: 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
batch
Type: 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.

FilterReturnsDescriptionExampleOutput
jsonstringConverts an object to a JSON string.{{ ['Hello', 'World'] | json }}["Hello","World"]
jsonfstringConverts an object to a formatted JSON string.{{ ['Hello', 'World'] | jsonf }}[
"Hello",
"World"]
jsonpobjectParses the string into a JSON object.{{ '{a:"b",c:2,d:true,e:null}' | jsonp }}{ "a": "b", "c": 2, "d": true, "e": null }
length
len
count
intStrings: 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 }}
100
12
upcasestringConverts a string to upper case.{{ "Hello world!" | upcase }}HELLO WORLD!
downcasestringConverts a string to lower case.{{ "Hello world!" | downcase }}hello world!
capitalizestringCapitalizes the first letter of a string.{{ "hello" | capitalize }}Hello
select [string]anySelects 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]anySelects 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]anyOperates 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 | arrayTakes 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 }}
0
Hello
last {count=1}any | arrayTakes 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 }}
10
world!
typestringGets 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 }}
string
int
timespan
format [string]stringFormats 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.33
Thursday July 25, 2024
to_stringstringConverts 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 }}
0
True
to_intintAttempts 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 }}
1
47
0
to_floatfloatAttempts 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.23
47.12
0
to_date_timedatetimeAttempts 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 AM
Saturday
to_bool {fallback=false}booleanAttempts 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 }}
false
true
true
true
false
to_base64stringConverts the input to a Base64-encoded string.{{ 'Hello Base64!' | to_base64 }}SGVsbG8gQmFzZTY0IQ==
from_base64stringConverts the input from a Base64-encoded string back into a (UTF-8) string.{{ 'SGVsbG8gQmFzZTY0IQ==' | from_base64 }}Hello Base64!
to_base64_urlstringConverts the input to a Base64-encoded URL safe string.{{ 'Hello Base64!' | to_base64_url }}SGVsbG8gQmFzZTY0IQ
from_base64_urlstringConverts the input from a Base64-encoded URL-safe string back into a (UTF-8) string.{{ 'SGVsbG8gQmFzZTY0IQ' | from_base64_url }}Hello Base64!
keysjarrayRetrieves a list of the keys present in an object/dictionary.{{ context | keys }}["cloudId", "workflowId", "workflowName", "triggerType", "runId", "startTime"]
itemsjarrayRetrieves 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]anyNull-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
📘

Note

This list does not encompass all filters available to the Liquid language. For a full filter reference, please refer to the Liquid filter documentation.