Skip to content

Latest commit

 

History

History
5192 lines (3593 loc) · 180 KB

workflow-definition-language-functions-reference.md

File metadata and controls

5192 lines (3593 loc) · 180 KB
titledescriptionservicesms.suitems.reviewerms.topicms.date
Reference guide for expression functions
Reference guide to workflow expression functions for Azure Logic Apps and Power Automate.
logic-apps
integration
estfan, niding, azla
conceptual
03/27/2025

Reference guide to workflow expression functions in Azure Logic Apps and Power Automate

[!INCLUDE logic-apps-sku-consumption-standard]

For workflow definitions in Azure Logic Apps and Power Automate, some expressions get their values from runtime actions that might not yet exist when your workflow starts running. To reference or process the values in these expressions, you can use expression functions provided by the Workflow Definition Language.

Note

This reference page applies to both Azure Logic Apps and Power Automate, but appears in the Azure Logic Apps documentation. Although this page refers specifically to logic app workflows, these functions work for both flows and logic app workflows. For more information about functions and expressions in Power Automate, review Use expressions in conditions.

For example, you can calculate values by using math functions, such as the add() function, when you want the sum from integers or floats. Here are other example tasks that you can perform with functions:

TaskFunction syntaxResult
Return a string in lowercase format.toLower('<text>')

For example: toLower('Hello')
"hello"
Return a globally unique identifier (GUID).guid()"c2ecc88d-88c8-4096-912c-d6f2e2b138ce"

To find functions based on their general purpose, review the following tables. Or, for detailed information about each function, see the alphabetical list.

Functions in expressions

To show how to use a function in an expression, this example shows how you can get the value from the customerName parameter and assign that value to the accountName property by using the parameters() function in an expression:

"accountName": "@parameters('customerName')"

Here are some other general ways that you can use functions in expressions:

TaskFunction syntax in an expression
Perform work with an item by passing that item to a function."@<functionName>(<item>)"
1. Get the parameterName's value by using the nested parameters() function.
2. Perform work with the result by passing that value to functionName.
"@<functionName>(parameters('<parameterName>'))"
1. Get the result from the nested inner function functionName.
2. Pass the result to the outer function functionName2.
"@<functionName2>(<functionName>(<item>))"
1. Get the result from functionName.
2. Given that the result is an object with property propertyName, get that property's value.
"@<functionName>(<item>).<propertyName>"

For example, the concat() function can take two or more string values as parameters. This function combines those strings into one string. You can either pass in string literals, for example, "Sophia" and "Owen" so that you get a combined string, "SophiaOwen":

"customerName": "@concat('Sophia', 'Owen')"

Or, you can get string values from parameters. This example uses the parameters() function in each concat() parameter and the firstName and lastName parameters. You then pass the resulting strings to the concat() function so that you get a combined string, for example, "SophiaOwen":

"customerName": "@concat(parameters('firstName'), parameters('lastName'))"

Either way, both examples assign the result to the customerName property.

Considerations for using functions

  • The designer doesn't evaluate runtime expressions that are used as function parameters at design time. The designer requires that all expressions can be fully evaluated at design time.

  • Function parameters are evaluated from left to right.

  • In the syntax for parameter definitions, a question mark (?) that appears after a parameter means the parameter is optional. For example, see getFutureTime().

  • Function expressions that appear inline with plain text require enclosing curly braces ({}) to use the expression's interpolated format instead. This format helps avoid parsing problems. If your function expression doesn't appear inline with plain text, no curly braces are necessary.

    The following example shows the correct and incorrect syntax:

    Correct: "<text>/@{<function-name>('<parameter-name>')}/<text>"

    Incorrect: "<text>/@<function-name>('<parameter-name>')/<text>"

    OK: "@<function-name>('<parameter-name>')"

The following sections organize functions based on their general purpose, or you can browse these functions in alphabetical order.

String functions

To work with strings, you can use these string functions and also some collection functions. String functions work only on strings.

String functionTask
chunkSplit a string or collection into chunks of equal length.
concatCombine two or more strings, and return the combined string.
endsWithCheck whether a string ends with the specified substring.
formatNumberReturn a number as a string based on the specified format
guidGenerate a globally unique identifier (GUID) as a string.
indexOfReturn the starting position for a substring.
isFloatReturn a boolean that indicates whether a string is a floating-point number.
isIntReturn a boolean that indicates whether a string is an integer.
lastIndexOfReturn the starting position for the last occurrence of a substring.
lengthReturn the number of items in a string or array.
nthIndexOfReturn the starting position or index value where the nth occurrence of a substring appears in a string.
replaceReplace a substring with the specified string, and return the updated string.
sliceReturn a substring by specifying the starting and ending position or value. See also substring.
splitReturn an array that contains substrings, separated by commas, from a larger string based on a specified delimiter character in the original string.
startsWithCheck whether a string starts with a specific substring.
substringReturn characters from a string, starting from the specified position. See also slice.
toLowerReturn a string in lowercase format.
toUpperReturn a string in uppercase format.
trimRemove leading and trailing whitespace from a string, and return the updated string.

Collection functions

To work with collections, generally arrays, strings, and sometimes, dictionaries, you can use these collection functions.

Collection functionTask
chunkSplit a string or collection into chunks of equal length.
containsCheck whether a collection has a specific item.
emptyCheck whether a collection is empty.
firstReturn the first item from a collection.
intersectionReturn a collection that has only the common items across the specified collections.
itemIf this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration.
joinReturn a string that has all the items from an array, separated by the specified character.
lastReturn the last item from a collection.
lengthReturn the number of items in a string or array.
reverseReverse the order of items in an array.
skipRemove items from the front of a collection, and return all the other items.
sortSort items in a collection.
takeReturn items from the front of a collection.
unionReturn a collection that has all the items from the specified collections.

Logical comparison functions

To work with conditions, compare values and expression results, or evaluate various kinds of logic, you can use these logical comparison functions. For the full reference about each function, see the alphabetical list.

Note

If you use logical functions or conditions to compare values, null values are converted to empty string ("") values. The behavior of conditions differs when you compare with an empty string instead of a null value. For more information, see the string() function.

Logical comparison functionTask
andCheck whether all expressions are true.
equalsCheck whether both values are equivalent.
greaterCheck whether the first value is greater than the second value.
greaterOrEqualsCheck whether the first value is greater than or equal to the second value.
ifCheck whether an expression is true or false. Based on the result, return a specified value.
isFloatReturn a boolean that indicates whether a string is a floating-point number.
isIntReturn a boolean that indicates whether a string is an integer.
lessCheck whether the first value is less than the second value.
lessOrEqualsCheck whether the first value is less than or equal to the second value.
notCheck whether an expression is false.
orCheck whether at least one expression is true.

Conversion functions

To change a value's type or format, you can use these conversion functions. For example, you can change a value from a Boolean to an integer. For more information about how Azure Logic Apps handles content types during conversion, see Handle content types. For the full reference about each function, see the alphabetical list.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Implicit data type conversions.

Conversion functionTask
arrayReturn an array from a single specified input. For multiple inputs, see createArray.
base64Return the base64-encoded version for a string.
base64ToBinaryReturn the binary version for a base64-encoded string.
base64ToStringReturn the string version for a base64-encoded string.
binaryReturn the binary version for an input value.
boolReturn the Boolean version for an input value.
createArrayReturn an array from multiple inputs.
dataUriReturn the data URI for an input value.
dataUriToBinaryReturn the binary version for a data URI.
dataUriToStringReturn the string version for a data URI.
decimalReturn the decimal number for a decimal string.
decodeBase64Return the string version for a base64-encoded string.
decodeDataUriReturn the binary version for a data URI.
decodeUriComponentReturn a string that replaces escape characters with decoded versions.
encodeUriComponentReturn a string that replaces URL-unsafe characters with escape characters.
floatReturn a floating point number for an input value.
intReturn the integer version for a string.
jsonReturn the JavaScript Object Notation (JSON) type value or object for a string or XML.
stringReturn the string version for an input value.
uriComponentReturn the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters.
uriComponentToBinaryReturn the binary version for a URI-encoded string.
uriComponentToStringReturn the string version for a URI-encoded string.
xmlReturn the XML version for a string.

Implicit data type conversions

Azure Logic Apps automatically or implicitly converts between some data types, so you don't have to manually perform these conversions. For example, if you use non-string values where strings are expected as inputs, Azure Logic Apps automatically converts the non-string values into strings.

For example, suppose a trigger returns a numerical value as output:

triggerBody()?['123']

If you use this numerical output where string input is expected, such as a URL, Azure Logic Apps automatically converts the value into a string by using the curly braces ({}) notation:

@{triggerBody()?['123']}

Base64 encoding and decoding

Azure Logic Apps automatically or implicitly performs base64 encoding or decoding, so you don't have to manually perform these conversions by using the corresponding functions:

  • base64(<value>)
  • base64ToBinary(<value>)
  • base64ToString(<value>)
  • base64(decodeDataUri(<value>))
  • concat('data:;base64,',<value>)
  • concat('data:,',encodeUriComponent(<value>))
  • decodeDataUri(<value>)

Note

If you manually add any of these functions while using the designer, either directly to a trigger or action or by using the expression editor, navigate away from the designer, and then return to the designer, the function disappears from the designer, leaving behind only the parameter values. This behavior also happens if you select a trigger or action that uses this function without editing the function's parameter values. This result affects only the function's visibility and not the effect. In code view, the function is unaffected. However, if you edit the function's parameter values, the function and its effect are both removed from code view, leaving behind only the function's parameter values.

Math functions

To work with integers and floats, you can use these math functions. For the full reference about each function, see the alphabetical list.

Math functionTask
addReturn the result from adding two numbers.
divReturn the result from dividing two numbers.
maxReturn the highest value from a set of numbers or an array.
minReturn the lowest value from a set of numbers or an array.
modReturn the remainder from dividing two numbers.
mulReturn the product from multiplying two numbers.
randReturn a random integer from a specified range.
rangeReturn an integer array that starts from a specified integer.
subReturn the result from subtracting the second number from the first number.

Date and time functions

To work with dates and times, you can use these date and time functions. For the full reference about each function, see the alphabetical list.

Date or time functionTask
addDaysAdd days to a timestamp.
addHoursAdd hours to a timestamp.
addMinutesAdd minutes to a timestamp.
addSecondsAdd seconds to a timestamp.
addToTimeAdd specified time units to a timestamp. See also getFutureTime.
convertFromUtcConvert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
convertTimeZoneConvert a timestamp from the source time zone to the target time zone.
convertToUtcConvert a timestamp from the source time zone to Universal Time Coordinated (UTC).
dateDifferenceReturn the difference between two dates as a timespan.
dayOfMonthReturn the day of the month component from a timestamp.
dayOfWeekReturn the day of the week component from a timestamp.
dayOfYearReturn the day of the year component from a timestamp.
formatDateTimeReturn the date from a timestamp.
getFutureTimeReturn the current timestamp plus the specified time units. See also addToTime.
getPastTimeReturn the current timestamp minus the specified time units. See also subtractFromTime.
parseDateTimeReturn the timestamp from a string that contains a timestamp.
startOfDayReturn the start of the day for a timestamp.
startOfHourReturn the start of the hour for a timestamp.
startOfMonthReturn the start of the month for a timestamp.
subtractFromTimeSubtract a number of time units from a timestamp. See also getPastTime.
ticksReturn the ticks property value for a specified timestamp.
utcNowReturn the current timestamp as a string.

Workflow functions

These workflow functions can help you:

  • Get details about a workflow instance at run time.
  • Work with the inputs used for instantiating logic apps or flows.
  • Reference the outputs from triggers and actions.

For example, you can reference the outputs from one action and use that data in a later action. For the full reference about each function, see the alphabetical list.

Workflow functionTask
actionReturn the current action's output at runtime, or values from other JSON name-and-value pairs. See also actions.
actionsReturn an action's output at runtime, or values from other JSON name-and-value pairs. See also action.
bodyReturn an action's body output at runtime.
formDataMultiValuesCreate an array with the values that match a key name in form-data or form-encoded action outputs.
formDataValueReturn a single value that matches a key name in an action's form-data or form-encoded output.
itemIf this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration.
itemsIf this function appears inside a Foreach or Until loop, return the current item from the specified loop.
iterationIndexesIf this function appears inside an Until loop, return the index value for the current iteration. You can use this function inside nested Until loops.
listCallbackUrlReturn the "callback URL" that calls a trigger or action.
multipartBodyReturn the body for a specific part in an action's output that has multiple parts.
outputsReturn an action's output at runtime.
parametersReturn the value for a parameter that is described in your workflow definition.
resultReturn the inputs and outputs from the top-level actions inside the specified scoped action, such as For_each, Until, and Scope.
triggerReturn a trigger's output at runtime, or from other JSON name-and-value pairs. See also triggerOutputs and triggerBody.
triggerBodyReturn a trigger's body output at runtime. See trigger.
triggerFormDataValueReturn a single value matching a key name in form-data or form-encoded trigger outputs.
triggerMultipartBodyReturn the body for a specific part in a trigger's multipart output.
triggerFormDataMultiValuesCreate an array whose values match a key name in form-data or form-encoded trigger outputs.
triggerOutputsReturn a trigger's output at runtime, or values from other JSON name-and-value pairs. See trigger.
variablesReturn the value for a specified variable.
workflowReturn all the details about the workflow itself during run time.

URI parsing functions

To work with uniform resource identifiers (URIs) and get various property values for these URIs, you can use these URI parsing functions. For the full reference about each function, see the alphabetical list.

URI parsing functionTask
uriHostReturn the host value for a uniform resource identifier (URI).
uriPathReturn the path value for a uniform resource identifier (URI).
uriPathAndQueryReturn the path and query values for a uniform resource identifier (URI).
uriPortReturn the port value for a uniform resource identifier (URI).
uriQueryReturn the query value for a uniform resource identifier (URI).
uriSchemeReturn the scheme value for a uniform resource identifier (URI).

Manipulation functions: JSON & XML

To work with JSON objects and XML nodes, you can use these manipulation functions. For the full reference about each function, see the alphabetical list.

Manipulation functionTask
addPropertyAdd a property and its value, or name-value pair, to a JSON object, and return the updated object.
coalesceReturn the first non-null value from one or more parameters.
removePropertyRemove a property from a JSON object and return the updated object.
setPropertySet the value for a JSON object's property and return the updated object.
xpathCheck XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values.

---------------------------------

All functions - alphabetical list

This section lists all the available functions in alphabetical order.

A

action

Return the current action's output at runtime, or values from other JSON name-and-value pairs, which you can assign to an expression. By default, this function references the entire action object, but you can optionally specify a property whose value you want. See also actions().

You can use the action() function only in these places:

  • The unsubscribe property for a webhook action so you can access the result from the original subscribe request
  • The trackedProperties property for an action
  • The do-until loop condition for an action
action() action().outputs.body.<property> 
ParameterRequiredTypeDescription
<property>NoStringThe name for the action object's property whose value you want: name, startTime, endTime, inputs, outputs, status, code, trackingId, and clientTrackingId. In the Azure portal, you can find these properties by reviewing a specific run history's details. For more information, see REST API - Workflow Run Actions.
Return valueTypeDescription
<action-output>StringThe output from the current action or property

actions

Return an action's output at runtime, or values from other JSON name-and-value pairs, which you can assign to an expression. By default, the function references the entire action object, but you can optionally specify a property whose value that you want. For shorthand versions, see body(). For the current action, see action().

Tip

The actions() function returns output as a string. If you need to work with a returned value as a JSON object, you first need to convert the string value. You can transform the string value into a JSON object using the Parse JSON action.

Note

Previously, you could use the actions() function or the conditions element when specifying that an action ran based on the output from another action. However, to declare explicitly dependencies between actions, you must now use the dependent action's runAfter property. To learn more about the runAfter property, see Catch and handle failures with the runAfter property.

actions('<actionName>') actions('<actionName>').outputs.body.<property> 
ParameterRequiredTypeDescription
<actionName>YesStringThe name for the action object whose output you want
<property>NoStringThe name for the action object's property whose value you want: name, startTime, endTime, inputs, outputs, status, code, trackingId, and clientTrackingId. In the Azure portal, you can find these properties by reviewing a specific run history's details. For more information, see REST API - Workflow Run Actions.
Return valueTypeDescription
<action-output>StringThe output from the specified action or property

Example

This example gets the status property value from the X action Get user at runtime:

actions('Get_user').outputs.body.status 

And returns this result: "Succeeded"

add

Return the result from adding two numbers.

add(<summand_1>, <summand_2>) 
ParameterRequiredTypeDescription
<summand_1>, <summand_2>YesInteger, Float, or mixedThe numbers to add
Return valueTypeDescription
<result-sum>Integer or FloatThe result from adding the specified numbers

Example

This example adds the specified numbers:

add(1, 1.5) 

And returns this result: 2.5

addDays

Add days to a timestamp.

addDays('<timestamp>', <days>, '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<days>YesIntegerThe positive or negative number of days to add
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp plus the specified number of days

Example 1

This example adds 10 days to the specified timestamp:

addDays('2018-03-15T00:00:00Z', 10) 

And returns this result: "2018-03-25T00:00:00.0000000Z"

Example 2

This example subtracts five days from the specified timestamp:

addDays('2018-03-15T00:00:00Z', -5) 

And returns this result: "2018-03-10T00:00:00.0000000Z"

addHours

Add hours to a timestamp.

addHours('<timestamp>', <hours>, '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<hours>YesIntegerThe positive or negative number of hours to add
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp plus the specified number of hours

Example 1

This example adds 10 hours to the specified timestamp:

addHours('2018-03-15T00:00:00Z', 10) 

And returns this result: "2018-03-15T10:00:00.0000000Z"

Example 2

This example subtracts five hours from the specified timestamp:

addHours('2018-03-15T15:00:00Z', -5) 

And returns this result: "2018-03-15T10:00:00.0000000Z"

addMinutes

Add minutes to a timestamp.

addMinutes('<timestamp>', <minutes>, '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<minutes>YesIntegerThe positive or negative number of minutes to add
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp plus the specified number of minutes

Example 1

This example adds 10 minutes to the specified timestamp:

addMinutes('2018-03-15T00:10:00Z', 10) 

And returns this result: "2018-03-15T00:20:00.0000000Z"

Example 2

This example subtracts five minutes from the specified timestamp:

addMinutes('2018-03-15T00:20:00Z', -5) 

And returns this result: "2018-03-15T00:15:00.0000000Z"

addProperty

Add a property and its value, or name-value pair, to a JSON object, and return the updated object. If the property already exists at runtime, the function fails and throws an error.

addProperty(<object>, '<property>', <value>) 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object where you want to add a property
<property>YesStringThe name for the property to add
<value>YesAnyThe value for the property
Return valueTypeDescription
<updated-object>ObjectThe updated JSON object with the specified property

To add a parent property to an existing property, use the setProperty() function, not the addProperty() function. Otherwise, the function returns only the child object as output.

setProperty(<object>, '<parent-property>', addProperty(<object>['<parent-property>'], '<child-property>', <value>) 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object where you want to add a property
<parent-property>YesStringThe name for parent property where you want to add the child property
<child-property>YesStringThe name for the child property to add
<value>YesAnyThe value to set for the specified property
Return valueTypeDescription
<updated-object>ObjectThe updated JSON object whose property you set

Example 1

This example adds the middleName property to a JSON object, which is converted from a string to JSON by using the JSON() function. The object already includes the firstName and surName properties. The function assigns the specified value to the new property and returns the updated object:

addProperty(json('{ "firstName": "Sophia", "lastName": "Owen" }'), 'middleName', 'Anne') 

Here's the current JSON object:

{ "firstName": "Sophia", "surName": "Owen" }

Here's the updated JSON object:

{ "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" }

Example 2

This example adds the middleName child property to the existing customerName property in a JSON object, which is converted from a string to JSON by using the JSON() function. The function assigns the specified value to the new property and returns the updated object:

setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }'), 'customerName', addProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }')['customerName'], 'middleName', 'Anne')) 

Here's the current JSON object:

{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }

Here's the updated JSON object:

{ "customerName": { "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" } }

addSeconds

Add seconds to a timestamp.

addSeconds('<timestamp>', <seconds>, '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<seconds>YesIntegerThe positive or negative number of seconds to add
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp plus the specified number of seconds

Example 1

This example adds 10 seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:00Z', 10) 

And returns this result: "2018-03-15T00:00:10.0000000Z"

Example 2

This example subtracts five seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:30Z', -5) 

And returns this result: "2018-03-15T00:00:25.0000000Z"

addToTime

Add the specified time units to a timestamp. See also getFutureTime().

addToTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<interval>YesIntegerThe number of specified time units to add
<timeUnit>YesStringThe unit of time to use with interval: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp plus the specified number of time units

Example 1

This example adds one day to the specified timestamp:

addToTime('2018-01-01T00:00:00Z', 1, 'Day') 

And returns this result: "2018-01-02T00:00:00.0000000Z"

Example 2

This example adds one day to the specified timestamp:

addToTime('2018-01-01T00:00:00Z', 1, 'Day', 'D') 

And returns the result using the optional "D" format: "Tuesday, January 2, 2018"

and

Check whether all expressions are true. Return true when all expressions are true, or return false when at least one expression is false.

and(<expression1>, <expression2>, ...) 
ParameterRequiredTypeDescription
<expression1>, <expression2>, ...YesBooleanThe expressions to check
Return valueTypeDescription
true or falseBooleanReturn true when all expressions are true. Return false when at least one expression is false.

Example 1

These examples check whether the specified Boolean values are all true:

and(true, true) and(false, true) and(false, false) 

And returns these results:

  • First example: Both expressions are true, so returns true.
  • Second example: One expression is false, so returns false.
  • Third example: Both expressions are false, so returns false.

Example 2

These examples check whether the specified expressions are all true:

and(equals(1, 1), equals(2, 2)) and(equals(1, 1), equals(1, 2)) and(equals(1, 2), equals(1, 3)) 

And returns these results:

  • First example: Both expressions are true, so returns true.
  • Second example: One expression is false, so returns false.
  • Third example: Both expressions are false, so returns false.

array

Return an array from a single specified input. For multiple inputs, see createArray().

array('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string for creating an array
Return valueTypeDescription
[<value>]ArrayAn array that contains the single specified input

Example

This example creates an array from the "hello" string:

array('hello') 

And returns this result: ["hello"]

B

base64

Return the base64-encoded version for a string.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Base64 encoding and decoding.

base64('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe input string
Return valueTypeDescription
<base64-string>StringThe base64-encoded version for the input string

Example

This example converts the "hello" string to a base64-encoded string:

base64('hello') 

And returns this result: "aGVsbG8="

base64ToBinary

Return the binary version for a base64-encoded string.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Base64 encoding and decoding.

base64ToBinary('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe base64-encoded string to convert
Return valueTypeDescription
<binary-for-base64-string>StringThe binary version for the base64-encoded string

Example

This example converts the "aGVsbG8=" base64-encoded string to a binary string:

base64ToBinary('aGVsbG8=') 

For example, suppose you're using an HTTP action to send a request. You can use base64ToBinary() to convert a base64-encoded string to binary data and send that data using the application/octet-stream content type in the request.

base64ToString

Return the string version for a base64-encoded string, effectively decoding the base64 string. Use this function rather than decodeBase64(), which is deprecated.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Base64 encoding and decoding.

base64ToString('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe base64-encoded string to decode
Return valueTypeDescription
<decoded-base64-string>StringThe string version for a base64-encoded string

Example

This example converts the "aGVsbG8=" base64-encoded string to just a string:

base64ToString('aGVsbG8=') 

And returns this result: "hello"

binary

Return the base64-encoded binary version of a string.

binary('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string to convert
Return valueTypeDescription
<binary-for-input-value>StringThe base64-encoded binary version for the specified string

Example

For example, you're using an HTTP action that returns an image or video file. You can use binary() to convert the value to a base-64 encoded content envelope model. Then, you can reuse the content envelope in other actions, such as Compose. You can use this function expression to send the string bytes with the application/octet-stream content type in the request.

body

Return an action's body output at runtime. Shorthand for actions('<actionName>').outputs.body. See actions().

body('<actionName>') 
ParameterRequiredTypeDescription
<actionName>YesStringThe name for the action's body output that you want
Return valueTypeDescription
<action-body-output>StringThe body output from the specified action

Example

This example gets the body output from the Get user X action:

body('Get_user') 

And returns this result:

"body": { "FullName": "Contoso Corporation", "Location": "Generic Town, USA", "Id": 283541717, "UserName": "ContosoInc", "FollowersCount": 172, "Description": "Leading the way in transforming the digital workplace.", "StatusesCount": 93, "FriendsCount": 126, "FavouritesCount": 46, "ProfileImageUrl": "https://pbs.twimg.com/profile_images/908820389907722240/gG9zaHcd_400x400.jpg" }

bool

Return the Boolean version of a value.

bool(<value>) 
ParameterRequiredTypeDescription
<value>YesAnyThe value to convert to Boolean.

If you're using bool() with an object, the value of the object must be a string or integer that can be converted to Boolean.

Return valueTypeDescription
true or falseBooleanThe Boolean version of the specified value.

Outputs

These examples show the different supported types of input for bool():

Input valueTypeReturn value
bool(1)Integertrue
bool(0)Integerfalse
bool(-1)Integertrue
bool('true')Stringtrue
bool('false')Stringfalse

C

chunk

Split a string or array into chunks of equal length.

chunk('<collection>', '<length>') chunk([<collection>], '<length>') 
ParameterRequiredTypeDescription
<collection>YesString or ArrayThe collection to split
<length>YesThe length of each chunk
Return valueTypeDescription
<collection>ArrayAn array of chunks with the specified length

Example 1

This example splits a string into chunks of length 10:

chunk('abcdefghijklmnopqrstuvwxyz', 10) 

And returns this result: ['abcdefghij', 'klmnopqrst', 'uvwxyz']

Example 2

This example splits an array into chunks of length 5.

chunk(createArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), 5) 

And returns this result: [ [1,2,3,4,5], [6,7,8,9,10], [11,12] ]

coalesce

Return the first non-null value from one or more parameters. Empty strings, empty arrays, and empty objects aren't null.

coalesce(<object_1>, <object_2>, ...) 
ParameterRequiredTypeDescription
<object_1>, <object_2>, ...YesAny, can mix typesOne or more items to check for null
Return valueTypeDescription
<first-non-null-item>AnyThe first item or value that isn't null. If all parameters are null, this function returns null.

Example

These examples return the first non-null value from the specified values, or null when all the values are null:

coalesce(null, true, false) coalesce(null, 'hello', 'world') coalesce(null, null, null) 

And returns these results:

  • First example: true
  • Second example: "hello"
  • Third example: null

concat

Combine two or more strings, and return the combined string.

concat('<text1>', '<text2>', ...) 
ParameterRequiredTypeDescription
<text1>, <text2>, ...YesStringAt least two strings to combine
Return valueTypeDescription
<text1text2...>StringThe string created from the combined input strings.



Note: The length of the result must not exceed 104,857,600 characters.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions when you use the concat() function with data that needs encoding or decoding:

  • concat('data:;base64,',<value>)
  • concat('data:,',encodeUriComponent(<value>))

However, if you use this function anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the function's visibility and not the effect unless you edit the function's parameter values, which removes the function and the effect from your code. For more information, review Base64 encoding and decoding.

Example

This example combines the strings "Hello" and "World":

concat('Hello', 'World') 

And returns this result: "HelloWorld"

contains

Check whether a collection has a specific item. Return true when the item is found, or return false when not found. This function is case-sensitive.

contains('<collection>', '<value>') contains([<collection>], '<value>') 

Specifically, this function works on these collection types:

  • A string to find a substring
  • An array to find a value
  • A dictionary to find a key
ParameterRequiredTypeDescription
<collection>YesString, Array, or DictionaryThe collection to check
<value>YesString, Array, or Dictionary, respectivelyThe item to find
Return valueTypeDescription
true or falseBooleanReturn true when the item is found. Return false when not found.

Example 1

This example checks the string "hello world" for the substring "world" and returns true:

contains('hello world', 'world') 

Example 2

This example checks the string "hello world" for the substring "universe" and returns false:

contains('hello world', 'universe') 

convertFromUtc

Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.

convertFromUtc('<timestamp>', '<destinationTimeZone>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<destinationTimeZone>YesStringThe name for the target time zone. For time zone names, review Microsoft Windows Default Time Zones.
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<converted-timestamp>StringThe timestamp converted to the target time zone without the timezone UTC offset.

Example 1

This example converts a timestamp to the specified time zone:

convertFromUtc('2018-01-01T08:00:00.0000000Z', 'Pacific Standard Time') 

And returns this result: "2018-01-01T00:00:00.0000000"

Example 2

This example converts a timestamp to the specified time zone and format:

convertFromUtc('2018-01-01T08:00:00.0000000Z', 'Pacific Standard Time', 'D') 

And returns this result: "Monday, January 1, 2018"

convertTimeZone

Convert a timestamp from the source time zone to the target time zone.

convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<sourceTimeZone>YesStringThe name for the source time zone. For time zone names, see Microsoft Windows Default Time Zones, but you might have to remove any punctuation from the time zone name.
<destinationTimeZone>YesStringThe name for the target time zone. For time zone names, see Microsoft Windows Default Time Zones, but you might have to remove any punctuation from the time zone name.
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<converted-timestamp>StringThe timestamp converted to the target time zone

Example 1

This example converts the source time zone to the target time zone:

convertTimeZone('2018-01-01T08:00:00.0000000Z', 'UTC', 'Pacific Standard Time') 

And returns this result: "2018-01-01T00:00:00.0000000"

Example 2

This example converts a time zone to the specified time zone and format:

convertTimeZone('2018-01-01T80:00:00.0000000Z', 'UTC', 'Pacific Standard Time', 'D') 

And returns this result: "Monday, January 1, 2018"

convertToUtc

Convert a timestamp from the source time zone to Universal Time Coordinated (UTC).

convertToUtc('<timestamp>', '<sourceTimeZone>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<sourceTimeZone>YesStringThe name for the source time zone. For time zone names, see Microsoft Windows Default Time Zones, but you might have to remove any punctuation from the time zone name.
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<converted-timestamp>StringThe timestamp converted to UTC

Example 1

This example converts a timestamp to UTC:

convertToUtc('01/01/2018 00:00:00', 'Pacific Standard Time') 

And returns this result: "2018-01-01T08:00:00.0000000Z"

Example 2

This example converts a timestamp to UTC:

convertToUtc('01/01/2018 00:00:00', 'Pacific Standard Time', 'D') 

And returns this result: "Monday, January 1, 2018"

createArray

Return an array from multiple inputs. For single input arrays, see array().

createArray('<object1>', '<object2>', ...) 
ParameterRequiredTypeDescription
<object1>, <object2>, ...YesAny, but not mixedAt least two items to create the array
Return valueTypeDescription
[<object1>, <object2>, ...]ArrayThe array created from all the input items

Example

This example creates an array from these inputs:

createArray('h', 'e', 'l', 'l', 'o') 

And returns this result: ["h", "e", "l", "l", "o"]

D

dataUri

Return a data uniform resource identifier (URI) for a string.

dataUri('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string to convert
Return valueTypeDescription
<data-uri>StringThe data URI for the input string

Example

This example creates a data URI for the "hello" string:

dataUri('hello') 

And returns this result: "data:text/plain;charset=utf-8;base64,aGVsbG8="

dataUriToBinary

Return the binary version for a data uniform resource identifier (URI). Use this function rather than decodeDataUri(). Although both functions work the same way, dataUriBinary() is preferred.

dataUriToBinary('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe data URI to convert
Return valueTypeDescription
<binary-for-data-uri>StringThe binary version for the data URI

Example

This example creates a binary version for this data URI:

dataUriToBinary('data:text/plain;charset=utf-8;base64,aGVsbG8=') 

And returns this result:

"01100100011000010111010001100001001110100111010001100101011110000111010000101111011100000 1101100011000010110100101101110001110110110001101101000011000010111001001110011011001010111 0100001111010111010101110100011001100010110100111000001110110110001001100001011100110110010 10011011000110100001011000110000101000111010101100111001101100010010001110011100000111101"

dataUriToString

Return the string version for a data uniform resource identifier (URI).

dataUriToString('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe data URI to convert
Return valueTypeDescription
<string-for-data-uri>StringThe string version for the data URI

Example

This example creates a string for this data URI:

dataUriToString('data:text/plain;charset=utf-8;base64,aGVsbG8=') 

And returns this result: "hello"

dateDifference

Return the difference between two timestamps as a timespan. This function subtracts startDate from endDate, and returns the result as timestamp in string format.

dateDifference('<startDate>', '<endDate>') 
ParameterRequiredTypeDescription
<startDate>YesStringA string that contains a timestamp
<endDate>YesStringA string that contains a timestamp
Return valueTypeDescription
<timespan>StringThe difference between the two timestamps, which is a timestamp in string format. If startDate is more recent than endDate, the result is a negative value.

Example

This example subtracts the first value from the second value:

dateDifference('2015-02-08', '2018-07-30') 

And returns this result: "1268.00:00:00"

dayOfMonth

Return the day of the month from a timestamp.

dayOfMonth('<timestamp>') 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
Return valueTypeDescription
<day-of-month>IntegerThe day of the month from the specified timestamp

Example

This example returns the number for the day of the month from this timestamp:

dayOfMonth('2018-03-15T13:27:36Z') 

And returns this result: 15

dayOfWeek

Return the day of the week from a timestamp.

dayOfWeek('<timestamp>') 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
Return valueTypeDescription
<day-of-week>IntegerThe day of the week from the specified timestamp where Sunday is 0, Monday is 1, and so on

Example

This example returns the number for the day of the week from this timestamp:

dayOfWeek('2018-03-15T13:27:36Z') 

And returns this result: 4

dayOfYear

Return the day of the year from a timestamp.

dayOfYear('<timestamp>') 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
Return valueTypeDescription
<day-of-year>IntegerThe day of the year from the specified timestamp

Example

This example returns the number of the day of the year from this timestamp:

dayOfYear('2018-03-15T13:27:36Z') 

And returns this result: 74

decimal

Returns a decimal number in a string as a decimal number. You can use this function when you're working with data that requires decimal precision and also as input for logical comparison functions and math functions. To capture and preserve precision when you use the result from the decimal() function, wrap any decimal output with the string function. This usage is shown in the following examples below where you can lose precision if you use the decimal result as a number.

Note

The decimal precision that's discussed in the context for this function and the Azure Logic Apps runtime is the same as the .NET decimal precision.

decimal('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe decimal number in a string
Return valueTypeDescription
<decimal>Decimal NumberThe decimal number for the input string

Example 1

This example creates a decimal that's used as a number:

decimal('1.2345678912312131') // Returns 1.234567891231213. 

Example 2

This example creates a decimal and then converts the result to a string for precision preservation:

string(decimal('1.2345678912312131')) // Returns "1.2345678912312131". 

Example 3

This example uses a math function on two decimal numbers and uses the result as a number:

add(decimal('1.2345678912312131'), decimal('1.2345678912312131')) // Returns 2.469135782462426. 

Example 4

This example uses a math function on two decimal numbers and converts the result to a string for precision preservation:

string(add(decimal('1.2345678912312131'), decimal('1.2345678912312131'))) // Returns "2.4691357824624262". 

decodeBase64 (deprecated)

This function is deprecated, so use base64ToString() instead.

decodeDataUri

Return the binary version for a data uniform resource identifier (URI). Consider using dataUriToBinary(), rather than decodeDataUri(). Although both functions work the same way, dataUriToBinary() is preferred.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Base64 encoding and decoding.

decodeDataUri('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe data URI string to decode
Return valueTypeDescription
<binary-for-data-uri>StringThe binary version for a data URI string

Example

This example returns the binary version for this data URI:

decodeDataUri('data:text/plain;charset=utf-8;base64,aGVsbG8=') 

And returns this result:

"01100100011000010111010001100001001110100111010001100101011110000111010000101111011100000 1101100011000010110100101101110001110110110001101101000011000010111001001110011011001010111 0100001111010111010101110100011001100010110100111000001110110110001001100001011100110110010 10011011000110100001011000110000101000111010101100111001101100010010001110011100000111101"

decodeUriComponent

Return a string that replaces escape characters with decoded versions.

decodeUriComponent('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string with the escape characters to decode
Return valueTypeDescription
<decoded-uri>StringThe updated string with the decoded escape characters

Example

This example replaces the escape characters in this string with decoded versions:

decodeUriComponent('https%3A%2F%2Fcontoso.com') 

And returns this result: "https://contoso.com"

div

Return the result from dividing two numbers. To get the remainder result, see mod().

div(<dividend>, <divisor>) 
ParameterRequiredTypeDescription
<dividend>YesInteger or FloatThe number to divide by the divisor
<divisor>YesInteger or FloatThe number that divides the dividend, but can't be zero
Return valueTypeDescription
<quotient-result>Integer or FloatThe result from dividing the first number by the second number. If either the dividend or divisor has Float type, the result has Float type.



Note: To convert the float result to an integer, try creating and calling a function in Azure from your logic app.

Example 1

Both examples return this value with Integer type: 2

div(10,5) div(11,5) 

Example 2

Both examples return this value with Float type: 2.2

div(11,5.0) div(11.0,5) 

E

encodeUriComponent

Return a uniform resource identifier (URI) encoded version for a string by replacing URL-unsafe characters with escape characters. Consider using uriComponent(), rather than encodeUriComponent(). Although both functions work the same way, uriComponent() is preferred.

Note

Azure Logic Apps automatically or implicitly performs base64 encoding and decoding, so you don't have to manually perform these conversions by using the encoding and decoding functions. However, if you use these functions anyway in the designer, you might experience unexpected rendering behaviors in the designer. These behaviors affect only the functions' visibility and not their effect unless you edit the functions' parameter values, which removes the functions and their effects from your code. For more information, see Base64 encoding and decoding.

encodeUriComponent('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string to convert to URI-encoded format
Return valueTypeDescription
<encoded-uri>StringThe URI-encoded string with escape characters

Example

This example creates a URI-encoded version for this string:

encodeUriComponent('https://contoso.com') 

And returns this result: "https%3A%2F%2Fcontoso.com"

empty

Check whether a collection is empty. Return true when the collection is empty, or return false when not empty.

empty('<collection>') empty([<collection>]) 
ParameterRequiredTypeDescription
<collection>YesString, Array, or ObjectThe collection to check
Return valueTypeDescription
true or falseBooleanReturn true when the collection is empty. Return false when not empty.

Example

These examples check whether the specified collections are empty:

empty('') empty('abc') 

And returns these results:

  • First example: Passes an empty string, so the function returns true.
  • Second example: Passes the string "abc", so the function returns false.

endsWith

Check whether a string ends with a specific substring. Return true when the substring is found, or return false when not found. This function isn't case-sensitive.

endsWith('<text>', '<searchText>') 
ParameterRequiredTypeDescription
<text>YesStringThe string to check
<searchText>YesStringThe ending substring to find
Return valueTypeDescription
true or falseBooleanReturn true when the ending substring is found. Return false when not found.

Example 1

This example checks whether the "hello world" string ends with the "world" string:

endsWith('hello world', 'world') 

And returns this result: true

Example 2

This example checks whether the "hello world" string ends with the "universe" string:

endsWith('hello world', 'universe') 

And returns this result: false

equals

Check whether both values, expressions, or objects are equivalent. Return true when both are equivalent, or return false when they're not equivalent.

equals('<object1>', '<object2>') 
ParameterRequiredTypeDescription
<object1>, <object2>YesVariousThe values, expressions, or objects to compare
Return valueTypeDescription
true or falseBooleanReturn true when both are equivalent. Return false when not equivalent.

Example

These examples check whether the specified inputs are equivalent.

equals(true, 1) equals('abc', 'abcd') 

And returns these results:

  • First example: Both values are equivalent, so the function returns true.
  • Second example: Both values aren't equivalent, so the function returns false.

F

first

Return the first item from a string or array.

first('<collection>') first([<collection>]) 
ParameterRequiredTypeDescription
<collection>YesString or ArrayThe collection where to find the first item
Return valueTypeDescription
<first-collection-item>AnyThe first item in the collection

Example

These examples find the first item in these collections:

first('hello') first(createArray(0, 1, 2)) 

And return these results:

  • First example: "h"
  • Second example: 0

float

Convert a string version for a floating-point number to an actual floating point number. You can use this function only when passing custom parameters to an app, for example, a logic app workflow or Power Automate flow. To convert floating-point strings represented in locale-specific formats, you can optionally specify an RFC 4646 locale code.

float('<value>', '<locale>'?) 
ParameterRequiredTypeDescription
<value>YesStringThe string that has a valid floating-point number to convert. The minimum and maximum values are the same as the limits for the float data type.
<locale>NoStringThe RFC 4646 locale code to use.

If not specified, default locale is used.

If locale isn't a valid value, an error is generated that the provided locale isn't valid or doesn't have an associated locale.
Return valueTypeDescription
<float-value>FloatThe floating-point number for the specified string. The minimum and maximum values are the same as the limits for the float data type.

Example 1

This example creates a string version for this floating-point number:

float('10,000.333') 

And returns this result: 10000.333

Example 2

This example creates a string version for this German-style floating-point number:

float('10.000,333', 'de-DE') 

And returns this result: 10000.333

formatDateTime

Return a timestamp in the specified format.

formatDateTime('<timestamp>', '<format>'?, '<locale>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.
<locale>NoStringThe locale to use. If unspecified, the value is en-us. If locale isn't a valid value, an error is generated.
Return valueTypeDescription
<reformatted-timestamp>StringThe updated timestamp in the specified format and locale, if specified.

Examples

formatDateTime('03/15/2018') // Returns '2018-03-15T00:00:00.0000000'. formatDateTime('03/15/2018 12:00:00', 'yyyy-MM-ddTHH:mm:ss') // Returns '2018-03-15T12:00:00'. formatDateTime('01/31/2016', 'dddd MMMM d') // Returns 'Sunday January 31'. formatDateTime('01/31/2016', 'dddd MMMM d', 'fr-fr') // Returns 'dimanche janvier 31'. formatDateTime('01/31/2016', 'dddd MMMM d', 'fr-FR') // Returns 'dimanche janvier 31'. formatDateTime('01/31/2016', 'dddd MMMM d', 'es-es') // Returns 'domingo enero 31'. 

formDataMultiValues

Return an array with values that match a key name in an action's form-data or form-encoded output.

formDataMultiValues('<actionName>', '<key>') 
ParameterRequiredTypeDescription
<actionName>YesStringThe action whose output has the key value you want
<key>YesStringThe name for the key whose value you want
Return valueTypeDescription
[<array-with-key-values>]ArrayAn array with all the values that match the specified key

Example

This example creates an array from the "Subject" key's value in the specified action's form-data or form-encoded output:

formDataMultiValues('Send_an_email', 'Subject') 

And returns the subject text in an array, for example: ["Hello world"]

formDataValue

Return a single value that matches a key name in an action's form-data or form-encoded output. If the function finds more than one match, the function throws an error.

formDataValue('<actionName>', '<key>') 
ParameterRequiredTypeDescription
<actionName>YesStringThe action whose output has the key value you want
<key>YesStringThe name for the key whose value you want
Return valueTypeDescription
<key-value>StringThe value in the specified key

Example

This example creates a string from the "Subject" key's value in the specified action's form-data or form-encoded output:

formDataValue('Send_an_email', 'Subject') 

And returns the subject text as a string, for example: "Hello world"

formatNumber

Return a number as a string that's based on the specified format.

formatNumber(<number>, <format>, <locale>?) 
ParameterRequiredTypeDescription
<number>YesInteger or DoubleThe value that you want to format.
<format>YesStringA composite format string that specifies the format that you want to use. For the supported numeric format strings, see Standard numeric format strings, which are supported by number.ToString(<format>, <locale>).
<locale>NoStringThe locale to use as supported by number.ToString(<format>, <locale>). If unspecified, the value is en-us. If locale isn't a valid value, an error is generated.
Return valueTypeDescription
<formatted-number>StringThe specified number as a string in the format that you specified. You can cast this return value to an int or float.

Example 1

Suppose that you want to format the number 1234567890. This example formats that number as the string "1,234,567,890.00".

formatNumber(1234567890, '0,0.00', 'en-us') 

*Example 2"

Suppose that you want to format the number 1234567890. This example formats the number to the string "1.234.567.890,00".

formatNumber(1234567890, '0,0.00', 'is-is') 

Example 3

Suppose that you want to format the number 17.35. This example formats the number to the string "$17.35".

formatNumber(17.35, 'C2') 

Example 4

Suppose that you want to format the number 17.35. This example formats the number to the string "17,35 kr".

formatNumber(17.35, 'C2', 'is-is') 

G

getFutureTime

Return the current timestamp plus the specified time units.

getFutureTime(<interval>, <timeUnit>, <format>?) 
ParameterRequiredTypeDescription
<interval>YesIntegerThe number of time units to add
<timeUnit>YesStringThe unit of time to use with interval: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<format>NoStringEither a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated that the provided format isn't valid and must be a numeric format string.
Return valueTypeDescription
<updated-timestamp>StringThe current timestamp plus the specified number of time units

Example 1

Suppose the current timestamp is "2018-03-01T00:00:00.0000000Z". This example adds five days to that timestamp:

getFutureTime(5, 'Day') 

And returns this result: "2018-03-06T00:00:00.0000000Z"

Example 2

Suppose the current timestamp is "2018-03-01T00:00:00.0000000Z". This example adds five days and converts the result to "D" format:

getFutureTime(5, 'Day', 'D') 

And returns this result: "Tuesday, March 6, 2018"

getPastTime

Return the current timestamp minus the specified time units.

getPastTime(<interval>, <timeUnit>, <format>?) 
ParameterRequiredTypeDescription
<interval>YesIntegerThe number of specified time units to subtract
<timeUnit>YesStringThe unit of time to use with interval: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<format>NoStringEither a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated that the provided format isn't valid and must be a numeric format string.
Return valueTypeDescription
<updated-timestamp>StringThe current timestamp minus the specified number of time units

Example 1

Suppose the current timestamp is "2018-02-01T00:00:00.0000000Z". This example subtracts five days from that timestamp:

getPastTime(5, 'Day') 

And returns this result: "2018-01-27T00:00:00.0000000Z"

Example 2

Suppose the current timestamp is "2018-02-01T00:00:00.0000000Z". This example subtracts five days and converts the result to "D" format:

getPastTime(5, 'Day', 'D') 

And returns this result: "Saturday, January 27, 2018"

greater

Check whether the first value is greater than the second value. Return true when the first value is more, or return false when less.

greater(<value>, <compareTo>) greater('<value>', '<compareTo>') 
ParameterRequiredTypeDescription
<value>YesInteger, Float, or StringThe first value to check whether greater than the second value
<compareTo>YesInteger, Float, or String, respectivelyThe comparison value
Return valueTypeDescription
true or falseBooleanReturn true when the first value is greater than the second value. Return false when the first value is equal to or less than the second value.

Example

These examples check whether the first value is greater than the second value:

greater(10, 5) greater('apple', 'banana') 

And return these results:

  • First example: true
  • Second example: false

greaterOrEquals

Check whether the first value is greater than or equal to the second value. Return true when the first value is greater or equal, or return false when the first value is less.

greaterOrEquals(<value>, <compareTo>) greaterOrEquals('<value>', '<compareTo>') 
ParameterRequiredTypeDescription
<value>YesInteger, Float, or StringThe first value to check whether greater than or equal to the second value
<compareTo>YesInteger, Float, or String, respectivelyThe comparison value
Return valueTypeDescription
true or falseBooleanReturn true when the first value is greater than or equal to the second value. Return false when the first value is less than the second value.

Example

These examples check whether the first value is greater or equal than the second value:

greaterOrEquals(5, 5) greaterOrEquals('apple', 'banana') 

And return these results:

  • First example: true
  • Second example: false

guid

Generate a globally unique identifier (GUID) as a string, for example, "c2ecc88d-88c8-4096-912c-d6f2e2b138ce":

guid() 

Also, you can specify a different format for the GUID other than the default format, "D", which is 32 digits separated by hyphens.

guid('<format>') 
ParameterRequiredTypeDescription
<format>NoStringA single format specifier for the returned GUID. By default, the format is "D", but you can use "N", "D", "B", "P", or "X".
Return valueTypeDescription
<GUID-value>StringA randomly generated GUID

Example

This example generates the same GUID, but as 32 digits, separated by hyphens, and enclosed in parentheses:

guid('P') 

And returns this result: "(c2ecc88d-88c8-4096-912c-d6f2e2b138ce)"

I

if

Check whether an expression is true or false. Based on the result, return a specified value. Parameters are evaluated from left to right.

if(<expression>, <valueIfTrue>, <valueIfFalse>) 
ParameterRequiredTypeDescription
<expression>YesBooleanThe expression to check
<valueIfTrue>YesAnyThe value to return when the expression is true
<valueIfFalse>YesAnyThe value to return when the expression is false
Return valueTypeDescription
<specified-return-value>AnyThe specified value that returns based on whether the expression is true or false

Example

This example returns "yes" because the specified expression returns true. Otherwise, the example returns "no":

if(equals(1, 1), 'yes', 'no') 

indexOf

Return the starting position or index value for a substring. This function isn't case-sensitive, and indexes start with the number 0.

indexOf('<text>', '<searchText>') 
ParameterRequiredTypeDescription
<text>YesStringThe string that has the substring to find
<searchText>YesStringThe substring to find
Return valueTypeDescription
<index-value>IntegerThe starting position or index value for the specified substring.

If the string isn't found, return the number -1.

Example

This example finds the starting index value for the "world" substring in the "hello world" string:

indexOf('hello world', 'world') 

And returns this result: 6

int

Convert the string version for an integer to an actual integer number.

int('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string version for the integer to convert. The minimum and maximum values are the same as the limits for the integer data type.
Return valueTypeDescription
<integer-result>IntegerThe integer version for the specified string. The minimum and maximum values are the same as the limits for the integer data type.

Example

This example creates an integer version for the string "10":

int('10') 

And returns this result: 10

isFloat

Return a boolean indicating whether a string is a floating-point number. By default, this function uses the invariant culture for the floating-point format. To identify floating-point numbers represented in other locale-specific formats, you can optionally specify an RFC 4646 locale code.

isFloat('<string>', '<locale>'?) 
ParameterRequiredTypeDescription
<value>YesStringThe string to examine
<locale>NoStringThe RFC 4646 locale code to use
Return valueTypeDescription
<boolean-result>BooleanA boolean that indicates whether the string is a floating-point number

Example 1

This example checks whether a string is a floating-point number in the invariant culture:

isFloat('10,000.00') 

And returns this result: true

Example 2

This example checks whether a string is a floating-point number in the German locale:

isFloat('10.000,00', 'de-DE') 

And returns this result: true

isInt

Return a boolean that indicates whether a string is an integer.

isInt('<string>') 
ParameterRequiredTypeDescription
<string>YesStringThe string to examine
Return valueTypeDescription
<boolean-result>BooleanA boolean that indicates whether the string is an integer

Example

This example checks whether a string is an integer:

isInt('10') 

And returns this result: true

item

When used inside a repeating action over an array, return the current item in the array during the action's current iteration. You can also get the values from that item's properties.

item() 
Return valueTypeDescription
<current-array-item>AnyThe current item in the array for the action's current iteration

Example

This example gets the body element from the current message for the "Send_an_email" action inside a for-each loop's current iteration:

item().body 

items

Return the current item from each cycle in a for-each loop. Use this function inside the for-each loop.

items('<loopName>') 
ParameterRequiredTypeDescription
<loopName>YesStringThe name for the for-each loop
Return valueTypeDescription
<item>AnyThe item from the current cycle in the specified for-each loop

Example

This example gets the current item from the specified for-each loop:

items('myForEachLoopName') 

iterationIndexes

Return the index value for the current iteration inside an Until loop. You can use this function inside nested Until loops.

iterationIndexes('<loopName>') 
ParameterRequiredTypeDescription
<loopName>YesStringThe name for the Until loop
Return valueTypeDescription
<index>IntegerThe index value for the current iteration inside the specified Until loop

Example

This example creates a counter variable and increments that variable by one during each iteration in an Until loop until the counter value reaches five. The example also creates a variable that tracks the current index for each iteration. During each iteration in the Until loop, the example increments the counter value and then assigns the counter value to the current index value and then increments the counter value. While in the loop, this example references the current iteration index by using the iterationIndexes function:

iterationIndexes('Until_Max_Increment')

{ "actions": { "Create_counter_variable": { "type": "InitializeVariable", "inputs": { "variables": [ { "name": "myCounter", "type": "Integer", "value": 0 } ] }, "runAfter": {} }, "Create_current_index_variable": { "type": "InitializeVariable", "inputs": { "variables": [ { "name": "myCurrentLoopIndex", "type": "Integer", "value": 0 } ] }, "runAfter": { "Create_counter_variable": [ "Succeeded" ] } }, "Until_Max_Increment": { "type": "Until", "actions": { "Assign_current_index_to_counter": { "type": "SetVariable", "inputs": { "name": "myCurrentLoopIndex", "value": "@variables('myCounter')" }, "runAfter": { "Increment_variable": [ "Succeeded" ] } }, "Compose": { "inputs": "'Current index: ' @{iterationIndexes('Until_Max_Increment')}", "runAfter": { "Assign_current_index_to_counter": [ "Succeeded" ] }, "type": "Compose" }, "Increment_variable": { "type": "IncrementVariable", "inputs": { "name": "myCounter", "value": 1 }, "runAfter": {} } }, "expression": "@equals(variables('myCounter'), 5)", "limit": { "count": 60, "timeout": "PT1H" }, "runAfter": { "Create_current_index_variable": [ "Succeeded" ] } } } }

J

json

Return the JavaScript Object Notation (JSON) type value, object, or array of objects for a string or XML.

json('<value>') json(xml('value')) 

Important

Without an XML schema that defines the output's structure, the function might return results where the structure greatly differs from the expected format, depending on the input.

This behavior makes this function unsuitable for scenarios where the output must conform to a well-defined contract, for example, in critical business systems or solutions.

ParameterRequiredTypeDescription
<value>YesString or XMLThe string or XML to convert
Return valueTypeDescription
<JSON-result>JSON native type, object, or arrayThe JSON native type value, object, or array of objects from the input string or XML.



- If you pass in XML that has a single child element in the root element, the function returns a single JSON object for that child element.

- If you pass in XML that has multiple child elements in the root element, the function returns an array that contains JSON objects for those child elements.

- If the string is null, the function returns an empty object.

Example 1

This example converts this string into a JSON value:

json('[1, 2, 3]') 

And returns this result: [1, 2, 3]

Example 2

This example converts this string into JSON:

json('{"fullName": "Sophia Owen"}') 

And returns this result:

{ "fullName": "Sophia Owen" }

Example 3

This example uses the json() and xml() functions to convert XML that has a single child element in the root element into a JSON object named person for that child element:

json(xml('<?xml version="1.0"?> <root> <person id="1"> <name>Sophia Owen</name> <occupation>Engineer</occupation> </person> </root>'))

And returns this result:

{ "?xml": { "@version": "1.0" }, "root": { "person": { "@id": "1", "name": "Sophia Owen", "occupation": "Engineer" } } }

Example 4

This example uses the json() and xml() functions to convert XML that has multiple child elements in the root element into an array named person that contains JSON objects for those child elements:

json(xml('<?xml version="1.0"?> <root> <person id="1"> <name>Sophia Owen</name> <occupation>Engineer</occupation> </person> <person id="2"> <name>John Doe</name> <occupation>Engineer</occupation> </person> </root>'))

And returns this result:

{ "?xml": { "@version": "1.0" }, "root": { "person": [ { "@id": "1", "name": "Sophia Owen", "occupation": "Engineer" }, { "@id": "2", "name": "John Doe", "occupation": "Engineer" } ] } }

intersection

Return a collection that has only the common items across the specified collections. To appear in the result, an item must appear in all the collections passed to this function. If one or more items have the same name, the last item with that name appears in the result.

intersection([<collection1>], [<collection2>], ...) intersection('<collection1>', '<collection2>', ...) 
ParameterRequiredTypeDescription
<collection1>, <collection2>, ...YesArray or Object, but not bothThe collections from where you want only the common items
Return valueTypeDescription
<common-items>Array or Object, respectivelyA collection that has only the common items across the specified collections

Example

This example finds the common items across these arrays:

intersection(createArray(1, 2, 3), createArray(101, 2, 1, 10), createArray(6, 8, 1, 2)) 

And returns an array with only these items: [1, 2]

join

Return a string that has all the items from an array and has each character separated by a delimiter.

join([<collection>], '<delimiter>') 
ParameterRequiredTypeDescription
<collection>YesArrayThe array that has the items to join
<delimiter>YesStringThe separator that appears between each character in the resulting string
Return valueTypeDescription
<char1><delimiter><char2><delimiter>...StringThe resulting string created from all the items in the specified array.



Note: The length of the result must not exceed 104,857,600 characters.

Example

This example creates a string from all the items in this array with the specified character as the delimiter:

join(createArray('a', 'b', 'c'), '.') 

And returns this result: "a.b.c"

L

last

Return the last item from a collection.

last('<collection>') last([<collection>]) 
ParameterRequiredTypeDescription
<collection>YesString or ArrayThe collection where to find the last item
Return valueTypeDescription
<last-collection-item>String or Array, respectivelyThe last item in the collection

Example

These examples find the last item in these collections:

last('abcd') last(createArray(0, 1, 2, 3)) 

And returns these results:

  • First example: "d"
  • Second example: 3

lastIndexOf

Return the starting position or index value for the last occurrence of a substring. This function isn't case-sensitive, and indexes start with the number 0.

lastIndexOf('<text>', '<searchText>') 
ParameterRequiredTypeDescription
<text>YesStringThe string that has the substring to find
<searchText>YesStringThe substring to find
Return valueTypeDescription
<ending-index-value>IntegerThe starting position or index value for the last occurrence of the specified substring.

If the string or substring value is empty, the following behavior occurs:

  • If only the string value is empty, the function returns -1.

  • If the string and substring values are both empty, the function returns 0.

  • If only the substring value is empty, the function returns the string length minus 1.

Examples

This example finds the starting index value for the last occurrence of the substring world substring in the string hello world hello world. The returned result is 18:

lastIndexOf('hello world hello world', 'world') 

This example is missing the substring parameter, and returns a value of 22 because the value of the input string (23) minus 1 is greater than 0.

lastIndexOf('hello world hello world', '') 

length

Return the number of items in a collection.

length('<collection>') length([<collection>]) 
ParameterRequiredTypeDescription
<collection>YesString or ArrayThe collection with the items to count
Return valueTypeDescription
<length-or-count>IntegerThe number of items in the collection

Example

These examples count the number of items in these collections:

length('abcd') length(createArray(0, 1, 2, 3)) 

And return this result: 4

less

Check whether the first value is less than the second value. Return true when the first value is less, or return false when the first value is more.

less(<value>, <compareTo>) less('<value>', '<compareTo>') 
ParameterRequiredTypeDescription
<value>YesInteger, Float, or StringThe first value to check whether less than the second value
<compareTo>YesInteger, Float, or String, respectivelyThe comparison item
Return valueTypeDescription
true or falseBooleanReturn true when the first value is less than the second value. Return false when the first value is equal to or greater than the second value.

Example

These examples check whether the first value is less than the second value.

less(5, 10) less('banana', 'apple') 

And return these results:

  • First example: true
  • Second example: false

lessOrEquals

Check whether the first value is less than or equal to the second value. Return true when the first value is less than or equal, or return false when the first value is more.

lessOrEquals(<value>, <compareTo>) lessOrEquals('<value>', '<compareTo>') 
ParameterRequiredTypeDescription
<value>YesInteger, Float, or StringThe first value to check whether less than or equal to the second value
<compareTo>YesInteger, Float, or String, respectivelyThe comparison item
Return valueTypeDescription
true or falseBooleanReturn true when the first value is less than or equal to the second value. Return false when the first value is greater than the second value.

Example

These examples check whether the first value is less or equal than the second value.

lessOrEquals(10, 10) lessOrEquals('apply', 'apple') 

And return these results:

  • First example: true
  • Second example: false

listCallbackUrl

Return the "callback URL" that calls a trigger or action. This function works only with triggers and actions for the HttpWebhook and ApiConnectionWebhook connector types, but not the Manual, Recurrence, HTTP, and APIConnection types.

listCallbackUrl() 
Return valueTypeDescription
<callback-URL>StringThe callback URL for a trigger or action

Example

This example shows a sample callback URL that this function might return:

"https://prod-01.westus.logic.azure.com:443/workflows/<*workflow-ID*>/triggers/manual/run?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=<*signature-ID*>"

M

max

Return the highest value from a list or array with numbers that is inclusive at both ends.

max(<number1>, <number2>, ...) max([<number1>, <number2>, ...]) 
ParameterRequiredTypeDescription
<number1>, <number2>, ...YesInteger, Float, or bothThe set of numbers from which you want the highest value
[<number1>, <number2>, ...]YesArray - Integer, Float, or bothThe array of numbers from which you want the highest value
Return valueTypeDescription
<max-value>Integer or FloatThe highest value in the specified array or set of numbers

Example

These examples get the highest value from the set of numbers and the array:

max(1, 2, 3) max(createArray(1, 2, 3)) 

And return this result: 3

min

Return the lowest value from a set of numbers or an array.

min(<number1>, <number2>, ...) min([<number1>, <number2>, ...]) 
ParameterRequiredTypeDescription
<number1>, <number2>, ...YesInteger, Float, or bothThe set of numbers from which you want the lowest value
[<number1>, <number2>, ...]YesArray - Integer, Float, or bothThe array of numbers from which you want the lowest value
Return valueTypeDescription
<min-value>Integer or FloatThe lowest value in the specified set of numbers or specified array

Example

These examples get the lowest value in the set of numbers and the array:

min(1, 2, 3) min(createArray(1, 2, 3)) 

And return this result: 1

mod

Return the remainder from dividing two numbers. To get the integer result, see div().

mod(<dividend>, <divisor>) 
ParameterRequiredTypeDescription
<dividend>YesInteger or FloatThe number to divide by the divisor
<divisor>YesInteger or FloatThe number that divides the dividend, but can't be zero
Return valueTypeDescription
<modulo-result>Integer or FloatThe remainder from dividing the first number by the second number

Example 1

This example divides the first number by the second number:

mod(3, 2) 

And returns this result: 1

Example 2

This example shows that if one or both values are negative, the result matches the sign of the dividend:

mod(-5, 2) mod(4, -3) 

The example returns these results:

  • First example: -1
  • Second example: 1

mul

Return the product from multiplying two numbers.

mul(<multiplicand1>, <multiplicand2>) 
ParameterRequiredTypeDescription
<multiplicand1>YesInteger or FloatThe number to multiply by multiplicand2
<multiplicand2>YesInteger or FloatThe number that multiples multiplicand1
Return valueTypeDescription
<product-result>Integer or FloatThe product from multiplying the first number by the second number

Example

These examples multiple the first number by the second number:

mul(1, 2) mul(1.5, 2) 

And return these results:

  • First example: 2
  • Second example 3

multipartBody

Return the body for a specific part in an action's output that has multiple parts.

multipartBody('<actionName>', <index>) 
ParameterRequiredTypeDescription
<actionName>YesStringThe name for the action that has output with multiple parts
<index>YesIntegerThe index value for the part that you want
Return valueTypeDescription
<body>StringThe body for the specified part

N

not

Check whether an expression is false. Return true when the expression is false, or return false when true.

not(<expression>) 
ParameterRequiredTypeDescription
<expression>YesBooleanThe expression to check
Return valueTypeDescription
true or falseBooleanReturn true when the expression is false. Return false when the expression is true.

Example 1

These examples check whether the specified expressions are false:

not(false) not(true) 

And return these results:

  • First example: The expression is false, so the function returns true.
  • Second example: The expression is true, so the function returns false.

Example 2

These examples check whether the specified expressions are false:

not(equals(1, 2)) not(equals(1, 1)) 

And return these results:

  • First example: The expression is false, so the function returns true.
  • Second example: The expression is true, so the function returns false.

nthIndexOf

Return the starting position or index value where the nth occurrence of a substring appears in a string.

nthIndexOf('<text>', '<searchText>', <occurrence>) 
ParameterRequiredTypeDescription
<text>YesStringThe string that contains the substring to find
<searchText>YesStringThe substring to find
<occurrence>YesIntegerA number that specifies the nth occurrence of the substring to find. If occurrence is negative, start searching from the end.
Return valueTypeDescription
<index-value>IntegerThe starting position or index value for the nth occurrence of the specified substring. If the substring isn't found or fewer than n occurrences of the substring exist, return -1.

Examples

nthIndexOf('123456789123465789', '1', 1) // Returns `0`. nthIndexOf('123456789123465789', '1', 2) // Returns `9`. nthIndexOf('123456789123465789', '12', 2) // Returns `9`. nthIndexOf('123456789123465789', '6', 4) // Returns `-1`. 

O

or

Check whether at least one expression is true. Return true when at least one expression is true, or return false when all are false.

or(<expression1>, <expression2>, ...) 
ParameterRequiredTypeDescription
<expression1>, <expression2>, ...YesBooleanThe expressions to check
Return valueTypeDescription
true or falseBooleanReturn true when at least one expression is true. Return false when all expressions are false.

Example 1

These examples check whether at least one expression is true:

or(true, false) or(false, false) 

And return these results:

  • First example: At least one expression is true, so the function returns true.
  • Second example: Both expressions are false, so the function returns false.

Example 2

These examples check whether at least one expression is true:

or(equals(1, 1), equals(1, 2))or(equals(1, 2), equals(1, 3))

And return these results:

  • First example: At least one expression is true, so the function returns true.
  • Second example: Both expressions are false, so the function returns false.

outputs

Return an action's outputs at runtime.

outputs('<actionName>') 
ParameterRequiredTypeDescription
<actionName>YesStringThe name for the action's output that you want
Return valueTypeDescription
<output>StringThe output from the specified action

Example

This example gets the output from the X action Get user:

outputs('Get_user') 

And returns this result:

{ "statusCode": 200, "headers": { "Pragma": "no-cache", "Vary": "Accept-Encoding", "x-ms-request-id": "a916ec8f52211265d98159adde2efe0b", "X-Content-Type-Options": "nosniff", "Timing-Allow-Origin": "*", "Cache-Control": "no-cache", "Date": "Mon, 09 Apr 2018 18:47:12 GMT", "Set-Cookie": "ARRAffinity=b9400932367ab5e3b6802e3d6158afffb12fcde8666715f5a5fbd4142d0f0b7d;Path=/;HttpOnly;Domain=twitter-wus.azconn-wus.p.azurewebsites.net", "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "Content-Type": "application/json; charset=utf-8", "Expires": "-1", "Content-Length": "339" }, "body": { "FullName": "Contoso Corporation", "Location": "Generic Town, USA", "Id": 283541717, "UserName": "ContosoInc", "FollowersCount": 172, "Description": "Leading the way in transforming the digital workplace.", "StatusesCount": 93, "FriendsCount": 126, "FavouritesCount": 46, "ProfileImageUrl": "https://pbs.twimg.com/profile_images/908820389907722240/gG9zaHcd_400x400.jpg" } }

P

parameters

Return the value for a parameter that is described in your workflow definition.

parameters('<parameterName>') 
ParameterRequiredTypeDescription
<parameterName>YesStringThe name for the parameter whose value you want
Return valueTypeDescription
<parameter-value>AnyThe value for the specified parameter

Example

Suppose that you have this JSON value:

{ "fullName": "Sophia Owen" }

This example gets the value for the specified parameter:

parameters('fullName') 

And returns this result: "Sophia Owen"

parseDateTime

Return the timestamp from a string that contains a timestamp.

parseDateTime('<timestamp>', '<locale>'?, '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<locale>NoStringThe locale to use.

If not specified, the default locale is en-us.

If locale isn't a valid value, an error is generated.
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information. If the format isn't specified, attempt parsing with multiple formats that are compatible with the provided locale. If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<parsed-timestamp>StringThe parsed timestamp in "o" (yyyy-MM-ddTHH:mm:ss.fffffffK) format, which complies with ISO 8601 and preserves time zone information.

Examples

parseDateTime('20/10/2014', 'fr-fr') // Returns '2014-10-20T00:00:00.0000000'. parseDateTime('20 octobre 2010', 'fr-FR') // Returns '2010-10-20T00:00:00.0000000'. parseDateTime('martes 20 octubre 2020', 'es-es') // Returns '2020-10-20T00:00:00.0000000'. parseDateTime('21052019', 'fr-fr', 'ddMMyyyy') // Returns '2019-05-21T00:00:00.0000000'. parseDateTime('20190521', 'fr-fr', 'yyyyMMdd') // Returns '2019-05-21T00:00:00.0000000'. parseDateTime('10/20/2014 15h', 'en-US', 'MM/dd/yyyy HH\h') // Returns '2014-10-20T15:00:00.0000000'. 

R

rand

Return a random integer from a specified range, which is inclusive only at the starting end.

rand(<minValue>, <maxValue>) 
ParameterRequiredTypeDescription
<minValue>YesIntegerThe lowest integer in the range
<maxValue>YesIntegerThe integer that follows the highest integer in the range that the function can return
Return valueTypeDescription
<random-result>IntegerThe random integer returned from the specified range

Example

This example gets a random integer from the specified range, excluding the maximum value:

rand(1, 5) 

And returns one of these numbers as the result: 1, 2, 3, or 4

range

Return an integer array that starts from a specified integer.

range(<startIndex>, <count>) 
ParameterRequiredTypeDescription
<startIndex>YesIntegerAn integer value that starts the array as the first item
<count>YesIntegerThe number of integers in the array. The count parameter value must be a positive integer that doesn't exceed 100,000.



Note: The sum of the startIndex and count values must not exceed 2,147,483,647.
Return valueTypeDescription
[<range-result>]ArrayThe array with integers starting from the specified index

Example

This example creates an integer array that starts from the specified index and has the specified number of integers:

range(1, 4) 

And returns this result: [1, 2, 3, 4]

removeProperty

Remove a property from an object and return the updated object. If the property that you try to remove doesn't exist, the function returns the original object.

removeProperty(<object>, '<property>') 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object from where you want to remove a property
<property>YesStringThe name for the property to remove
Return valueTypeDescription
<updated-object>ObjectThe updated JSON object without the specified property

To remove a child property from an existing property, use this syntax:

removeProperty(<object>['<parent-property>'], '<child-property>') 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object whose property you want to remove
<parent-property>YesStringThe name for parent property with the child property that you want to remove
<child-property>YesStringThe name for the child property to remove
Return valueTypeDescription
<updated-object>ObjectThe updated JSON object whose child property that you removed

Example 1

This example removes the middleName property from a JSON object, which is converted from a string to JSON by using the JSON() function, and returns the updated object:

removeProperty(json('{ "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" }'), 'middleName') 

Here's the current JSON object:

{ "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" }

Here's the updated JSON object:

{ "firstName": "Sophia", "surName": "Owen" }

Example 2

This example removes the middleName child property from a customerName parent property in a JSON object, which is converted from a string to JSON by using the JSON() function, and returns the updated object:

removeProperty(json('{ "customerName": { "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" } }')['customerName'], 'middleName') 

Here's the current JSON object:

{ "customerName": { "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" } }

Here's the updated JSON object:

{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }

replace

Replace a substring with the specified string, and return the result string. This function is case-sensitive.

replace('<text>', '<oldText>', '<newText>') 
ParameterRequiredTypeDescription
<text>YesStringThe string that has the substring to replace
<oldText>YesStringThe substring to replace
<newText>YesStringThe replacement string
Return valueTypeDescription
<updated-text>StringThe updated string after replacing the substring

If the substring isn't found, return the original string.

Example

This example finds the "old" substring in "the old string" and replaces "old" with "new":

replace('the old string', 'old', 'new') 

And returns this result: "the new string"

result

Return the results from the top-level actions in the specified scoped action, such as a For_each, Until, or Scope action. The result() function accepts a single parameter, which is the scope's name, and returns an array that contains information from the first-level actions in that scope. These action objects include the same attributes as the attributes returned by the actions() function, such as the action's start time, end time, status, inputs, correlation IDs, and outputs.

Note

This function returns information only from the first-level actions in the scoped action and not from deeper nested actions such as switch or condition actions.

For example, you can use this function to get the results from failed actions so that you can diagnose and handle exceptions. For more information, see Get context and results for failures.

result('<scopedActionName>') 
ParameterRequiredTypeDescription
<scopedActionName>YesStringThe name of the scoped action where you want the inputs and outputs from the top-level actions inside that scope
Return valueTypeDescription
<array-object>Array objectAn array that contains arrays of inputs and outputs from each top-level action inside the specified scope

Example

This example returns the inputs and outputs from each iteration of an HTTP action inside that's in a For_each loop by using the result() function in the Compose action:

{ "actions": { "Compose": { "inputs": "@result('For_each')", "runAfter": { "For_each": [ "Succeeded" ] }, "type": "compose" }, "For_each": { "actions": { "HTTP": { "inputs": { "method": "GET", "uri": "https://httpstat.us/200" }, "runAfter": {}, "type": "Http" } }, "foreach": "@triggerBody()", "runAfter": {}, "type": "Foreach" } } }

Here's how the example returned array might look where the outer outputs object contains the inputs and outputs from each iteration of the actions inside the For_each action.

[ { "name": "HTTP", "outputs": [ { "name": "HTTP", "inputs": { "uri": "https://httpstat.us/200", "method": "GET" }, "outputs": { "statusCode": 200, "headers": { "X-AspNetMvc-Version": "5.1", "Access-Control-Allow-Origin": "*", "Cache-Control": "private", "Date": "Tue, 20 Aug 2019 22:15:37 GMT", "Set-Cookie": "ARRAffinity=0285cfbea9f2ee7", "Server": "Microsoft-IIS/10.0", "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "Content-Length": "0" }, "startTime": "2019-08-20T22:15:37.6919631Z", "endTime": "2019-08-20T22:15:37.95762Z", "trackingId": "6bad3015-0444-4ccd-a971-cbb0c99a7.....", "clientTrackingId": "085863526764.....", "code": "OK", "status": "Succeeded" } }, { "name": "HTTP", "inputs": { "uri": "https://httpstat.us/200", "method": "GET" }, "outputs": { "statusCode": 200, "headers": { "X-AspNetMvc-Version": "5.1", "Access-Control-Allow-Origin": "*", "Cache-Control": "private", "Date": "Tue, 20 Aug 2019 22:15:37 GMT", "Set-Cookie": "ARRAffinity=0285cfbea9f2ee7", "Server": "Microsoft-IIS/10.0", "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "Content-Length": "0" }, "startTime": "2019-08-20T22:15:37.6919631Z", "endTime": "2019-08-20T22:15:37.95762Z", "trackingId": "9987e889-981b-41c5-aa27-f3e0e59bf69.....", "clientTrackingId": "085863526764.....", "code": "OK", "status": "Succeeded" } } ] } ]

reverse

Reverse the order of items in a collection. When you use this function with sort(), you can sort a collection in descending order.

reverse([<collection>]) 
ParameterRequiredTypeDescription
<collection>YesArrayThe collection to reverse
Return valueTypeDescription
[<updated-collection>]ArrayThe reversed collection

Example

This example reverses an array of integers:

reverse(createArray(0, 1, 2, 3)) 

And returns this array: [3,2,1,0]

S

setProperty

Set the value for JSON object's property and return the updated object. If the property that you try to set doesn't exist, the property gets added to the object. To add a new property, use the addProperty() function.

setProperty(<object>, '<property>', <value>) 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object whose property you want to set
<property>YesStringThe name for the existing or new property to set
<value>YesAnyThe value to set for the specified property

To set the child property in a child object, use a nested setProperty() call instead. Otherwise, the function returns only the child object as output.

setProperty(<object>, '<parent-property>', setProperty(<object>['parentProperty'], '<child-property>', <value>)) 
ParameterRequiredTypeDescription
<object>YesObjectThe JSON object whose property you want to set
<parent-property>YesStringThe name for parent property with the child property that you want to set
<child-property>YesStringThe name for the child property to set
<value>YesAnyThe value to set for the specified property
Return valueTypeDescription
<updated-object>ObjectThe updated JSON object whose property you set

Example 1

This example sets the surName property in a JSON object, which is converted from a string to JSON by using the JSON() function. The function assigns the specified value to the property and returns the updated object:

setProperty(json('{ "firstName": "Sophia", "surName": "Owen" }'), 'surName', 'Hartnett') 

Here's the current JSON object:

{ "firstName": "Sophia", "surName": "Owen" }

Here's the updated JSON object:

{ "firstName": "Sophia", "surName": "Hartnett" }

Example 2

This example sets the surName child property for the customerName parent property in a JSON object, which is converted from a string to JSON by using the JSON() function. The function assigns the specified value to the property and returns the updated object:

setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }'), 'customerName', setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }')['customerName'], 'surName', 'Hartnett')) 

Here's the current JSON object:

{ "customerName": { "firstName": "Sophie", "surName": "Owen" } }

Here's the updated JSON object:

{ "customerName": { "firstName": "Sophie", "surName": "Hartnett" } }

skip

Remove items from the front of a collection, and return all the other items.

skip([<collection>], <count>) 
ParameterRequiredTypeDescription
<collection>YesArrayThe collection whose items you want to remove
<count>YesIntegerA positive integer for the number of items to remove at the front
Return valueTypeDescription
[<updated-collection>]ArrayThe updated collection after removing the specified items

Example

This example removes one item, the number 0, from the front of the specified array:

skip(createArray(0, 1, 2, 3), 1) 

And returns this array with the remaining items: [1,2,3]

slice

Return a substring by specifying the starting and ending position or value. See also substring().

slice('<text>', <startIndex>, <endIndex>?) 
ParameterRequiredTypeDescription
<text>YesStringThe string that contains the substring to find
<startIndex>YesIntegerThe zero-based starting position or value for where to begin searching for the substring

- If startIndex is greater than the string length, return an empty string.

- If startIndex is negative, start searching at the index value that's the sum of the string length and startIndex.
<endIndex>NoIntegerThe zero-based ending position or value for where to end searching for the substring. The character located at the ending index value isn't included in the search.

- If endIndex isn't specified or greater than the string length, search up to the end of the string.

- If endIndex is negative, end searching at the index value that the sum of the string length and endIndex.
Return valueTypeDescription
<slice-result>StringA new string that contains the found substring

Examples

slice('Hello World', 2) // Returns 'llo World'. slice('Hello World', 30) // Returns ''. slice('Hello World', 10, 2) // Returns ''. slice('Hello World', 0) // Returns 'Hello World'. slice('Hello World', 2, 5) // Returns 'llo'. slice('Hello World', 6, 20) // Returns 'World'. slice('Hello World', -2) // Returns 'ld'. slice('Hello World', 3, -1) // Returns 'lo Worl'. slice('Hello World', 3, 3) // Returns ''. 

sort

Sort items in a collection. You can sort the collection objects using any key that contains a simple type.

sort([<collection>], <sortBy>?) 
ParameterRequiredTypeDescription
<collection>YesArrayThe collection with the items to sort
<sortBy>NoStringThe key to use for sorting the collection objects
Return valueTypeDescription
[<updated-collection>]ArrayThe sorted collection

Example 1

This example sorts an array of integers:

sort(createArray(2, 1, 0, 3)) 

And returns this array: [0,1,2,3]

Example 2

This example sorts an array of objects by key:

sort(createArray(json('{ "first": "Amalie", "last": "Rose" }'), json('{ "first": "Elise", "last": "Renee" }')), 'last') 

And returns this array: [{ "first": "Elise", "last": "Renee" }, {"first": "Amalie", "last": "Rose" }')]

split

Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.

split('<text>', '<delimiter>') 
ParameterRequiredTypeDescription
<text>YesStringThe string to separate into substrings based on the specified delimiter in the original string
<delimiter>YesStringThe character in the original string to use as the delimiter
Return valueTypeDescription
[<substring1>,<substring2>,...]ArrayAn array that contains substrings from the original string, separated by commas

Example 1

This example creates an array with substrings from the specified string based on the specified character as the delimiter:

split('a_b_c', '_') 

And returns this array as the result: ["a","b","c"]

Example 2

This example creates an array with a single element when no delimiter exists in the string:

split('a_b_c', ' ') 

And returns this array as the result: ["a_b_c"]

startOfDay

Return the start of the day for a timestamp.

startOfDay('<timestamp>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe specified timestamp but starting at the zero-hour mark for the day

Example

This example finds the start of the day for this timestamp:

startOfDay('2018-03-15T13:30:30Z') 

And returns this result: "2018-03-15T00:00:00.0000000Z"

startOfHour

Return the start of the hour for a timestamp.

startOfHour('<timestamp>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe specified timestamp but starting at the zero-minute mark for the hour

Example

This example finds the start of the hour for this timestamp:

startOfHour('2018-03-15T13:30:30Z') 

And returns this result: "2018-03-15T13:00:00.0000000Z"

startOfMonth

Return the start of the month for a timestamp.

startOfMonth('<timestamp>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe specified timestamp but starting on the first day of the month at the zero-hour mark

Example 1

This example returns the start of the month for this timestamp:

startOfMonth('2018-03-15T13:30:30Z') 

And returns this result: "2018-03-01T00:00:00.0000000Z"

Example 2

This example returns the start of the month in the specified format for this timestamp:

startOfMonth('2018-03-15T13:30:30Z', 'yyyy-MM-dd') 

And returns this result: "2018-03-01"

startsWith

Check whether a string starts with a specific substring. Return true when the substring is found, or return false when not found. This function isn't case-sensitive.

startsWith('<text>', '<searchText>') 
ParameterRequiredTypeDescription
<text>YesStringThe string to check
<searchText>YesStringThe starting string to find
Return valueTypeDescription
true or falseBooleanReturn true when the starting substring is found. Return false when not found.

Example 1

This example checks whether the "hello world" string starts with the "hello" substring:

startsWith('hello world', 'hello') 

And returns this result: true

Example 2

This example checks whether the "hello world" string starts with the "greetings" substring:

startsWith('hello world', 'greetings') 

And returns this result: false

string

Return the string version for a value.

string(<value>) 
ParameterRequiredTypeDescription
<value>YesAnyThe value to convert. If this value is null or evaluates to null, the value is converted to an empty string ("") value.



For example, if you assign a string variable to a non-existent property, which you can access with the ? operator, the null value is converted to an empty string. However, comparing a null value isn't the same as comparing an empty string.
Return valueTypeDescription
<string-value>StringThe string version for the specified value. If the value parameter is null or evaluates to null, this value is returned as an empty string ("") value.

Example 1

This example creates the string version for this number:

string(10) 

And returns this result: "10"

Example 2

This example creates a string for the specified JSON object and uses the backslash character (\) as an escape character for the double-quotation mark (").

string( { "name": "Sophie Owen" } ) 

And returns this result: "{ \\"name\\": \\"Sophie Owen\\" }"

sub

Return the result from subtracting the second number from the first number.

sub(<minuend>, <subtrahend>) 
ParameterRequiredTypeDescription
<minuend>YesInteger or FloatThe number from which to subtract the subtrahend
<subtrahend>YesInteger or FloatThe number to subtract from the minuend
Return valueTypeDescription
<result>Integer or FloatThe result from subtracting the second number from the first number

Example

This example subtracts the second number from the first number:

sub(10.3, .3) 

And returns this result: 10

substring

Return characters from a string, starting from the specified position, or index. Index values start with the number 0. See also slice().

substring('<text>', <startIndex>, <length>) 
ParameterRequiredTypeDescription
<text>YesStringThe string whose characters you want
<startIndex>YesIntegerA positive number equal to or greater than 0 that you want to use as the starting position or index value
<length>NoIntegerA positive number of characters that you want in the substring

Note

Make sure that the sum from adding the startIndex and length parameter values is less than the length of the string that you provide for the text parameter. Otherwise, you get an error, unlike similar functions in other languages where the result is the substring from the startIndex to the end of the string. The length parameter is optional and if not provided, the substring() function takes all the characters beginning from startIndex to the end of the string.

Return valueTypeDescription
<substring-result>StringA substring with the specified number of characters, starting at the specified index position in the source string

Example

This example creates a five-character substring from the specified string, starting from the index value 6:

substring('hello world', 6, 5) 

And returns this result: "world"

subtractFromTime

Subtract a number of time units from a timestamp. See also getPastTime.

subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?) 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string that contains the timestamp
<interval>YesIntegerThe number of specified time units to subtract
<timeUnit>YesStringThe unit of time to use with interval: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<updated-timestamp>StringThe timestamp minus the specified number of time units

Example 1

This example subtracts one day from this timestamp:

subtractFromTime('2018-01-02T00:00:00Z', 1, 'Day') 

And returns this result: "2018-01-01T00:00:00.0000000Z"

Example 2

This example subtracts one day from this timestamp:

subtractFromTime('2018-01-02T00:00:00Z', 1, 'Day', 'D') 

And returns this result using the optional "D" format: "Monday, January, 1, 2018"

T

take

Return items from the front of a collection.

take('<collection>', <count>) take([<collection>], <count>) 
ParameterRequiredTypeDescription
<collection>YesString or ArrayThe collection whose items you want
<count>YesIntegerA positive integer for the number of items that you want from the front
Return valueTypeDescription
<subset> or [<subset>]String or Array, respectivelyA string or array that has the specified number of items taken from the front of the original collection

Example

These examples get the specified number of items from the front of these collections:

take('abcde', 3) take(createArray(0, 1, 2, 3, 4), 3) 

And return these results:

  • First example: "abc"
  • Second example: [0, 1, 2]

ticks

Returns the number of ticks, which are 100-nanosecond intervals, since January 1, 0001 12:00:00 midnight (or DateTime.Ticks in C#) up to the specified timestamp. For more information, see this topic: DateTime.Ticks Property (System).

ticks('<timestamp>') 
ParameterRequiredTypeDescription
<timestamp>YesStringThe string for a timestamp
Return valueTypeDescription
<ticks-number>IntegerThe number of ticks since the specified timestamp

toLower

Return a string in lowercase format. If a character in the string doesn't have a lowercase version, that character stays unchanged in the returned string.

toLower('<text>') 
ParameterRequiredTypeDescription
<text>YesStringThe string to return in lowercase format
Return valueTypeDescription
<lowercase-text>StringThe original string in lowercase format

Example

This example converts this string to lowercase:

toLower('Hello World') 

And returns this result: "hello world"

toUpper

Return a string in uppercase format. If a character in the string doesn't have an uppercase version, that character stays unchanged in the returned string.

toUpper('<text>') 
ParameterRequiredTypeDescription
<text>YesStringThe string to return in uppercase format
Return valueTypeDescription
<uppercase-text>StringThe original string in uppercase format

Example

This example converts this string to uppercase:

toUpper('Hello World') 

And returns this result: "HELLO WORLD"

trigger

Return a trigger's output at runtime, or values from other JSON name-and-value pairs, which you can assign to an expression.

  • Inside a trigger's inputs, this function returns the output from the previous execution.

  • Inside a trigger's condition, this function returns the output from the current execution.

By default, the function references the entire trigger object, but you can optionally specify a property whose value that you want. Also, this function has shorthand versions available, see triggerOutputs() and triggerBody().

trigger() 
Return valueTypeDescription
<trigger-output>StringThe output from a trigger at runtime

triggerBody

Return a trigger's body output at runtime. Shorthand for trigger().outputs.body. See trigger().

triggerBody() 
Return valueTypeDescription
<trigger-body-output>StringThe body output from the trigger

triggerFormDataMultiValues

Return an array with values that match a key name in a trigger's form-data or form-encoded output.

triggerFormDataMultiValues('<key>') 
ParameterRequiredTypeDescription
<key>YesStringThe name for the key whose value you want
Return valueTypeDescription
[<array-with-key-values>]ArrayAn array with all the values that match the specified key

Example

This example creates an array from the "feedUrl" key value in an RSS trigger's form-data or form-encoded output:

triggerFormDataMultiValues('feedUrl') 

And returns this array as an example result: ["https://feeds.a.dj.com/rss/RSSMarketsMain.xml"]

triggerFormDataValue

Return a string with a single value that matches a key name in a trigger's form-data or form-encoded output. If the function finds more than one match, the function throws an error.

triggerFormDataValue('<key>') 
ParameterRequiredTypeDescription
<key>YesStringThe name for the key whose value you want
Return valueTypeDescription
<key-value>StringThe value in the specified key

Example

This example creates a string from the "feedUrl" key value in an RSS trigger's form-data or form-encoded output:

triggerFormDataValue('feedUrl') 

And returns this string as an example result: "https://feeds.a.dj.com/rss/RSSMarketsMain.xml"

triggerMultipartBody

Return the body for a specific part in a trigger's output that has multiple parts.

triggerMultipartBody(<index>) 
ParameterRequiredTypeDescription
<index>YesIntegerThe index value for the part that you want
Return valueTypeDescription
<body>StringThe body for the specified part in a trigger's multipart output

triggerOutputs

Return a trigger's output at runtime, or values from other JSON name-and-value pairs. Shorthand for trigger().outputs. See trigger().

triggerOutputs() 
Return valueTypeDescription
<trigger-output>StringThe output from a trigger at runtime

trim

Remove leading and trailing whitespace from a string, and return the updated string.

trim('<text>') 
ParameterRequiredTypeDescription
<text>YesStringThe string that has the leading and trailing whitespace to remove
Return valueTypeDescription
<updatedText>StringAn updated version for the original string without leading or trailing whitespace

Example

This example removes the leading and trailing whitespace from the string " Hello World ":

trim(' Hello World ') 

And returns this result: "Hello World"

U

union

Return a collection that has all the items from the specified collections. To appear in the result, an item can appear in any collection passed to this function. If one or more items have the same name, the last item with that name appears in the result.

union('<collection1>', '<collection2>', ...) union([<collection1>], [<collection2>], ...) 
ParameterRequiredTypeDescription
<collection1>, <collection2>, ...YesArray or Object, but not bothThe collections from where you want all the items
Return valueTypeDescription
<updatedCollection>Array or Object, respectivelyA collection with all the items from the specified collections - no duplicates

Example

This example gets all the items from these collections:

union(createArray(1, 2, 3), createArray(1, 2, 10, 101)) 

And returns this result: [1, 2, 3, 10, 101]

uriComponent

Return a uniform resource identifier (URI) encoded version for a string by replacing URL-unsafe characters with escape characters. Use this function rather than encodeUriComponent(). Although both functions work the same way, uriComponent() is preferred.

uriComponent('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string to convert to URI-encoded format
Return valueTypeDescription
<encoded-uri>StringThe URI-encoded string with escape characters

Example

This example creates a URI-encoded version for this string:

uriComponent('https://contoso.com') 

And returns this result: "https%3A%2F%2Fcontoso.com"

uriComponentToBinary

Return the binary version for a uniform resource identifier (URI) component.

uriComponentToBinary('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe URI-encoded string to convert
Return valueTypeDescription
<binary-for-encoded-uri>StringThe binary version for the URI-encoded string. The binary content is base64-encoded and represented by $content.

Example

This example creates the binary version for this URI-encoded string:

uriComponentToBinary('https%3A%2F%2Fcontoso.com') 

And returns this result:

"001000100110100001110100011101000111000000100101001100 11010000010010010100110010010001100010010100110010010001 10011000110110111101101110011101000110111101110011011011 110010111001100011011011110110110100100010"

uriComponentToString

Return the string version for a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.

uriComponentToString('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe URI-encoded string to decode
Return valueTypeDescription
<decoded-uri>StringThe decoded version for the URI-encoded string

Example

This example creates the decoded string version for this URI-encoded string:

uriComponentToString('https%3A%2F%2Fcontoso.com') 

And returns this result: "https://contoso.com"

uriHost

Return the host value for a uniform resource identifier (URI).

uriHost('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose host value you want
Return valueTypeDescription
<host-value>StringThe host value for the specified URI

Example

This example finds the host value for this URI:

uriHost('https://www.localhost.com:8080') 

And returns this result: "www.localhost.com"

uriPath

Return the path value for a uniform resource identifier (URI).

uriPath('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose path value you want
Return valueTypeDescription
<path-value>StringThe path value for the specified URI. If path doesn't have a value, return the "/" character.

Example

This example finds the path value for this URI:

uriPath('https://www.contoso.com/catalog/shownew.htm?date=today') 

And returns this result: "/catalog/shownew.htm"

uriPathAndQuery

Return the path and query values for a uniform resource identifier (URI).

uriPathAndQuery('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose path and query values you want
Return valueTypeDescription
<path-query-value>StringThe path and query values for the specified URI. If path doesn't specify a value, return the "/" character.

Example

This example finds the path and query values for this URI:

uriPathAndQuery('https://www.contoso.com/catalog/shownew.htm?date=today') 

And returns this result: "/catalog/shownew.htm?date=today"

uriPort

Return the port value for a uniform resource identifier (URI).

uriPort('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose port value you want
Return valueTypeDescription
<port-value>IntegerThe port value for the specified URI. If port doesn't specify a value, return the default port for the protocol.

Example

This example returns the port value for this URI:

uriPort('https://www.localhost:8080') 

And returns this result: 8080

uriQuery

Return the query value for a uniform resource identifier (URI).

uriQuery('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose query value you want
Return valueTypeDescription
<query-value>StringThe query value for the specified URI

Example

This example returns the query value for this URI:

uriQuery('https://www.contoso.com/catalog/shownew.htm?date=today') 

And returns this result: "?date=today"

uriScheme

Return the scheme value for a uniform resource identifier (URI).

uriScheme('<uri>') 
ParameterRequiredTypeDescription
<uri>YesStringThe URI whose scheme value you want
Return valueTypeDescription
<scheme-value>StringThe scheme value for the specified URI

Example

This example returns the scheme value for this URI:

uriScheme('https://www.contoso.com/catalog/shownew.htm?date=today') 

And returns this result: "http"

utcNow

Return the current timestamp.

utcNow('<format>') 

Optionally, you can specify a different format with the <format> parameter.

ParameterRequiredTypeDescription
<format>NoStringA numeric format string that is either a single format specifier or a custom format pattern. The default format for the timestamp is "o" (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with ISO 8601 and preserves time zone information.

If the format isn't a valid value, an error is generated.
Return valueTypeDescription
<current-timestamp>StringThe current date and time

Example 1

Suppose today is April 15, 2018 at 1:00:00 PM. This example gets the current timestamp:

utcNow() 

And returns this result: "2018-04-15T13:00:00.0000000Z"

Example 2

Suppose today is April 15, 2018 at 1:00:00 PM. This example gets the current timestamp using the optional "D" format:

utcNow('D') 

And returns this result: "Sunday, April 15, 2018"

V

variables

Return the value for a specified variable.

variables('<variableName>') 
ParameterRequiredTypeDescription
<variableName>YesStringThe name for the variable whose value you want
Return valueTypeDescription
<variable-value>AnyThe value for the specified variable

Example

Suppose the current value for a "numItems" variable is 20. This example gets the integer value for this variable:

variables('numItems') 

And returns this result: 20

W

workflow

Return all the details about the workflow itself during run time.

workflow().<property> 
ParameterRequiredTypeDescription
<property>NoStringThe name for the workflow property whose value you want



By default, a workflow object has these properties: name, type, id, location, run, and tags.



- The run property value is a JSON object that includes these properties: name, type, and id.



- The tags property is a JSON object that includes tags that are associated with your logic app in Azure Logic Apps or flow in Power Automate and the values for those tags. For more information about tags in Azure resources, review Tag resources, resource groups, and subscriptions for logical organization in Azure.



Note: By default, a logic app has no tags, but a Power Automate flow has the flowDisplayName and environmentName tags.

Example 1

This example returns the name for a workflow's current run:

workflow().run.name

Example 2

If you use Power Automate, you can create a @workflow() expression that uses the tags output property to get the values from your flow's flowDisplayName or environmentName property.

For example, you can send custom email notifications from the flow itself that link back to your flow. These notifications can include an HTML link that contains the flow's display name in the email title and follows this syntax:

<a href=https://flow.microsoft.com/manage/environments/@{workflow()['tags']['environmentName']}/flows/@{workflow()['name']}/details>Open flow @{workflow()['tags']['flowDisplayName']}</a>

X

xml

Return the XML version for a string that contains a JSON object.

xml('<value>') 
ParameterRequiredTypeDescription
<value>YesStringThe string with the JSON object to convert

The JSON object must have only one root property, which can't be an array.
Use the backslash character (\) as an escape character for the double quotation mark (").
Return valueTypeDescription
<xml-version>ObjectThe encoded XML for the specified string or JSON object

Example 1

This example converts the string to XML:

xml('<name>Sophia Owen</name>')

And returns this result XML:

<name>Sophia Owen</name>

Example 2

This example creates the XML version for this string, which contains a JSON object:

xml(json('{ "name": "Sophia Owen" }'))

And returns this result XML:

<name>Sophia Owen</name>

Example 3

Suppose you have this JSON object:

{ "person": { "name": "Sophia Owen", "city": "Seattle" } }

This example creates XML for a string that contains this JSON object:

xml(json('{"person": {"name": "Sophia Owen", "city": "Seattle"}}'))

And returns this result XML:

<person> <name>Sophia Owen</name> <city>Seattle</city> <person>

xpath

Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values. An XPath expression, or just "XPath", helps you navigate an XML document structure so that you can select nodes or compute values in the XML content.

Note

In Consumption and Standard logic apps, all function expressions use the .NET XPath library. XPath expressions are compatible with the underlying .NET library and support only the expression that the underlying .NET library supports.

xpath('<xml>', '<xpath>') 
ParameterRequiredTypeDescription
<xml>YesAnyThe XML string to search for nodes or values that match an XPath expression value
<xpath>YesAnyThe XPath expression used to find matching XML nodes or values
Return valueTypeDescription
<xml-node>XMLAn XML node when only a single node matches the specified XPath expression
<value>AnyThe value from an XML node when only a single value matches the specified XPath expression
[<xml-node1>, <xml-node2>, ...] -or- [<value1>, <value2>, ...]ArrayAn array with XML nodes or values that match the specified XPath expression

Example 1

Suppose that you have this 'items' XML string:

<?xml version="1.0"?> <produce> <item> <name>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>

This example passes in the XPath expression, '/produce/item/name/text()', to find the nodes that match the <name></name> node in the 'items' XML string, and returns an array with those node values:

xpath(xml(parameters('items')), '/produce/item/name/text()')

The example also uses the parameters() function to get the XML string from 'items' and convert the string to XML format by using the xml() function.

Here's the result array populated with values of the nodes that match <name></name>:

[ Gala, Honeycrisp ]

Example 2

Following on Example 1, this example passes in the XPath expression, '/produce/item/name[1]', to find the first name element that is the child of the item element.

xpath(xml(parameters('items')), '/produce/item/name[1]')

Here's the result: Gala

Example 3

Following on Example 1, this example pass in the XPath expression, '/produce/item/name[last()]', to find the last name element that is the child of the item element.

xpath(xml(parameters('items')), '/produce/item/name[last()]')

Here's the result: Honeycrisp

Example 4

In this example, suppose your items XML string also contains the attributes, expired='true' and expired='false':

<?xml version="1.0"?> <produce> <item> <nameexpired='true'>Gala</name> <type>apple</type> <count>20</count> </item> <item> <nameexpired='false'>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>

This example passes in the XPath expression, '//name[@expired]', to find all the name elements that have the expired attribute:

xpath(xml(parameters('items')), '//name[@expired]')

Here's the result: [ Gala, Honeycrisp ]

Example 5

In this example, suppose your items XML string contains only this attribute, expired = 'true':

<?xml version="1.0"?> <produce> <item> <nameexpired='true'>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>

This example passes in the XPath expression, '//name[@expired = 'true']', to find all the name elements that have the attribute, expired = 'true':

xpath(xml(parameters('items')), '//name[@expired = 'true']')

Here's the result: [ Gala ]

Example 6

In this example, suppose your items XML string also contains these attributes:

  • expired='true' price='12'
  • expired='false' price='40'
<?xml version="1.0"?> <produce> <item> <nameexpired='true'price='12'>Gala</name> <type>apple</type> <count>20</count> </item> <item> <nameexpired='false'price='40'>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>

This example passes in the XPath expression, '//name[@price>35]', to find all the name elements that have price > 35:

xpath(xml(parameters('items')), '//name[@price>35]')

Here's the result: Honeycrisp

Example 7

In this example, suppose your items XML string is the same as in Example 1:

<?xml version="1.0"?> <produce> <item> <name>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>

This example finds nodes that match the <count></count> node and adds those node values with the sum() function:

xpath(xml(parameters('items')), 'sum(/produce/item/count)')

Here's the result: 30

Example 8

In this example, suppose you have this XML string, which includes the XML document namespace, xmlns="https://contoso.com":

<?xml version="1.0"?><filexmlns="https://contoso.com"><location>Paris</location></file>

These expressions use either XPath expression, /*[name()="file"]/*[name()="location"] or /*[local-name()="file" and namespace-uri()="https://contoso.com"]/*[local-name()="location"], to find nodes that match the <location></location> node. These examples show the syntax that you use in either the designer or in the expression editor:

  • xpath(xml(body('Http')), '/*[name()="file"]/*[name()="location"]')
  • xpath(xml(body('Http')), '/*[local-name()="file" and namespace-uri()="https://contoso.com"]/*[local-name()="location"]')

Here's the result node that matches the <location></location> node:

<location xmlns="https://contoso.com">Paris</location>

Important

If you work in code view, escape the double quotation mark (") by using the backslash character (\). For example, you need to use escape characters when you serialize an expression as a JSON string. However, if you're work in the designer or expression editor, you don't need to escape the double quotation mark because the backslash character is added automatically to the underlying definition, for example:

  • Code view: xpath(xml(body('Http')), '/*[name()=\"file\"]/*[name()=\"location\"]')

  • Expression editor: xpath(xml(body('Http')), '/*[name()="file"]/*[name()="location"]')

Example 9

Following on Example 8, this example uses the XPath expression, 'string(/*[name()="file"]/*[name()="location"])', to find the value in the <location></location> node:

xpath(xml(body('Http')), 'string(/*[name()="file"]/*[name()="location"])')

Here's the result: Paris

Next steps

Learn about the Workflow Definition Language

close