ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.5 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference |
| Last Crawled | 2026-03-28 14:24:50 (14 days ago) |
| First Indexed | 2025-07-14 18:37:47 (9 months ago) |
| HTTP Status Code | 200 |
| Meta Title | Reference for functions in workflow expressions - Azure Logic Apps | Microsoft Learn |
| Meta Description | Learn about expression functions for workflows in Azure Logic Apps and Power Automate. |
| Meta Canonical | null |
| Boilerpipe Text | Reference guide to functions in expressions for workflows in Azure Logic Apps and Power Automate
Applies to:
Azure Logic Apps (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 guide applies to both Azure Logic Apps and Power Automate, but exists in the
Azure Logic Apps documentation. Although guide refers specifically to logic app workflows,
these functions work for both flows in Power Automate and workflows in Azure Logic Apps.
For more information about functions and expressions in Power Automate, see
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:
Task
Function syntax
Result
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
.
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:
Task
Function 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.
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
.
To work with strings, you can use these string functions and also some
collection functions
. String functions work only on strings.
String function
Task
chunk
Split a string or collection into chunks of equal length.
concat
Combine two or more strings, and return the combined string.
endsWith
Check whether a string ends with the specified substring.
formatNumber
Return a number as a string based on the specified format
guid
Generate a globally unique identifier (GUID) as a string.
indexOf
Return the starting position for a substring.
isFloat
Return a boolean that indicates whether a string is a floating-point number.
isInt
Return a boolean that indicates whether a string is an integer.
lastIndexOf
Return the starting position for the last occurrence of a substring.
length
Return the number of items in a string or array.
nthIndexOf
Return the starting position or index value where the
n
th occurrence of a substring appears in a string.
replace
Replace a substring with the specified string, and return the updated string.
slice
Return a substring by specifying the starting and ending position or value. See also
substring
.
split
Return an array that contains substrings, separated by commas, from a larger string based on a specified delimiter character in the original string.
startsWith
Check whether a string starts with a specific substring.
substring
Return characters from a string, starting from the specified position. See also
slice
.
toLower
Return a string in lowercase format.
toUpper
Return a string in uppercase format.
trim
Remove leading and trailing whitespace from a string, and return the updated string.
To work with collections, generally arrays, strings, and sometimes, dictionaries, you can use these collection functions.
Collection function
Task
chunk
Split a string or collection into chunks of equal length.
contains
Check whether a collection has a specific item.
empty
Check whether a collection is empty.
first
Return the first item from a collection.
intersection
Return a collection that has
only
the common items across the specified collections.
item
If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration.
join
Return a string that has
all
the items from an array, separated by the specified character.
last
Return the last item from a collection.
length
Return the number of items in a string or array.
reverse
Reverse the order of items in an array.
skip
Remove items from the front of a collection, and return
all the other
items.
sort
Sort items in a collection.
take
Return items from the front of a collection.
union
Return a collection that has
all
the items from the specified collections.
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 function
Task
and
Check whether all expressions are true.
equals
Check whether both values are equivalent.
greater
Check whether the first value is greater than the second value.
greaterOrEquals
Check whether the first value is greater than or equal to the second value.
if
Check whether an expression is true or false. Based on the result, return a specified value.
isFloat
Return a boolean that indicates whether a string is a floating-point number.
isInt
Return a boolean that indicates whether a string is an integer.
less
Check whether the first value is less than the second value.
lessOrEquals
Check whether the first value is less than or equal to the second value.
not
Check whether an expression is false.
or
Check whether at least one expression is true.
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 function
Task
array
Return an array from a single specified input. For multiple inputs, see
createArray
.
base64
Return the base64-encoded version for a string.
base64ToBinary
Return the binary version for a base64-encoded string.
base64ToString
Return the string version for a base64-encoded string.
binary
Return the binary version for an input value.
bool
Return the Boolean version for an input value.
createArray
Return an array from multiple inputs.
dataUri
Return the data URI for an input value.
dataUriToBinary
Return the binary version for a data URI.
dataUriToString
Return the string version for a data URI.
decimal
Return the decimal number for a decimal string.
decodeBase64
Return the string version for a base64-encoded string.
decodeDataUri
Return the binary version for a data URI.
decodeUriComponent
Return a string that replaces escape characters with decoded versions.
encodeUriComponent
Return a string that replaces URL-unsafe characters with escape characters.
float
Return a floating point number for an input value.
int
Return the integer version for a string.
json
Return the JavaScript Object Notation (JSON) type value or object for a string or XML.
string
Return the string version for an input value.
uriComponent
Return the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters.
uriComponentToBinary
Return the binary version for a URI-encoded string.
uriComponentToString
Return the string version for a URI-encoded string.
xml
Return the XML version for a string.
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']}
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.
To work with integers and floats, you can use these math functions.
For the full reference about each function, see the
alphabetical list
.
Math function
Task
add
Return the result from adding two numbers.
div
Return the result from dividing two numbers.
max
Return the highest value from a set of numbers or an array.
min
Return the lowest value from a set of numbers or an array.
mod
Return the remainder from dividing two numbers.
mul
Return the product from multiplying two numbers.
rand
Return a random integer from a specified range.
range
Return an integer array that starts from a specified integer.
sub
Return the result from subtracting the second number from the first number.
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 function
Task
addDays
Add days to a timestamp.
addHours
Add hours to a timestamp.
addMinutes
Add minutes to a timestamp.
addSeconds
Add seconds to a timestamp.
addToTime
Add specified time units to a timestamp. See also
getFutureTime
.
convertFromUtc
Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
convertTimeZone
Convert a timestamp from the source time zone to the target time zone.
convertToUtc
Convert a timestamp from the source time zone to Universal Time Coordinated (UTC).
dateDifference
Return the difference between two dates as a timespan.
dayOfMonth
Return the day of the month component from a timestamp.
dayOfWeek
Return the day of the week component from a timestamp.
dayOfYear
Return the day of the year component from a timestamp.
formatDateTime
Return the date from a timestamp.
getFutureTime
Return the current timestamp plus the specified time units. See also
addToTime
.
getPastTime
Return the current timestamp minus the specified time units. See also
subtractFromTime
.
parseDateTime
Return the timestamp from a string that contains a timestamp.
startOfDay
Return the start of the day for a timestamp.
startOfHour
Return the start of the hour for a timestamp.
startOfMonth
Return the start of the month for a timestamp.
subtractFromTime
Subtract a number of time units from a timestamp. See also
getPastTime
.
ticks
Return the
ticks
property value for a specified timestamp.
utcNow
Return the current timestamp as a string.
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 function
Task
action
Return the current action's output at runtime, or values from other JSON name-and-value pairs. See also
actions
.
actions
Return an action's output at runtime, or values from other JSON name-and-value pairs. See also
action
.
body
Return an action's
body
output at runtime.
formDataMultiValues
Create an array with the values that match a key name in
form-data
or
form-encoded
action outputs.
formDataValue
Return a single value that matches a key name in an action's
form-data
or
form-encoded output
.
item
If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration.
items
If this function appears inside a Foreach or Until loop, return the current item from the specified loop.
iterationIndexes
If this function appears inside an Until loop, return the index value for the current iteration. You can use this function inside nested Until loops.
listCallbackUrl
Return the "callback URL" that calls a trigger or action.
multipartBody
Return the body for a specific part in an action's output that has multiple parts.
outputs
Return an action's output at runtime.
parameters
Return the value for a parameter that is described in your workflow definition.
result
Return the inputs and outputs from the top-level actions inside the specified scoped action, such as
For_each
,
Until
, and
Scope
.
trigger
Return a trigger's output at runtime, or from other JSON name-and-value pairs. See also
triggerOutputs
and
triggerBody
.
triggerBody
Return a trigger's
body
output at runtime. See
trigger
.
triggerFormDataValue
Return a single value matching a key name in
form-data
or
form-encoded
trigger outputs.
triggerMultipartBody
Return the body for a specific part in a trigger's multipart output.
triggerFormDataMultiValues
Create an array whose values match a key name in
form-data
or
form-encoded
trigger outputs.
triggerOutputs
Return a trigger's output at runtime, or values from other JSON name-and-value pairs. See
trigger
.
variables
Return the value for a specified variable.
workflow
Return all the details about the workflow itself during run time.
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 function
Task
uriHost
Return the
host
value for a uniform resource identifier (URI).
uriPath
Return the
path
value for a uniform resource identifier (URI).
uriPathAndQuery
Return the
path
and
query
values for a uniform resource identifier (URI).
uriPort
Return the
port
value for a uniform resource identifier (URI).
uriQuery
Return the
query
value for a uniform resource identifier (URI).
uriScheme
Return the
scheme
value for a uniform resource identifier (URI).
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 function
Task
addProperty
Add a property and its value, or name-value pair, to a JSON object, and return the updated object.
coalesce
Return the first non-null value from one or more parameters.
removeProperty
Remove a property from a JSON object and return the updated object.
setProperty
Set the value for a JSON object's property and return the updated object.
xpath
Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values.
This section lists all the available functions in alphabetical order.
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>
Parameter
Required
Type
Description
<
property
>
No
String
The 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 value
Type
Description
<
action-output
>
Object
The JSON object output from the current action or property
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()
.
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>
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The name for the action object whose output you want
<
property
>
No
String
The 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 value
Type
Description
<
action-output
>
Object
The JSON object 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"
Return the result from adding two numbers.
add(<summand_1>, <summand_2>)
Parameter
Required
Type
Description
<
summand_1
>, <
summand_2
>
Yes
Integer, Float, or mixed
The numbers to add
Return value
Type
Description
<
result-sum
>
Integer or Float
The result from adding the specified numbers
Example
This example adds the specified numbers:
add(1, 1.5)
And returns this result:
2.5
Add days to a timestamp.
addDays('<timestamp>', <days>, '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
days
>
Yes
Integer
The positive or negative number of days to add
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Add hours to a timestamp.
addHours('<timestamp>', <hours>, '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
hours
>
Yes
Integer
The positive or negative number of hours to add
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Add minutes to a timestamp.
addMinutes('<timestamp>', <minutes>, '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
minutes
>
Yes
Integer
The positive or negative number of minutes to add
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
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>)
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object where you want to add a property
<
property
>
Yes
String
The name for the property to add
<
value
>
Yes
Any
The value for the property
Return value
Type
Description
<
updated-object
>
Object
The 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>)
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object where you want to add a property
<
parent-property
>
Yes
String
The name for parent property where you want to add the child property
<
child-property
>
Yes
String
The name for the child property to add
<
value
>
Yes
Any
The value to set for the specified property
Return value
Type
Description
<
updated-object
>
Object
The 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"
}
}
Add seconds to a timestamp.
addSeconds('<timestamp>', <seconds>, '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
seconds
>
Yes
Integer
The positive or negative number of seconds to add
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Add the specified time units to a timestamp. See also
getFutureTime()
.
addToTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
interval
>
Yes
Integer
The number of specified time units to add
<
timeUnit
>
Yes
String
The unit of time to use with
interval
: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
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>, ...)
Parameter
Required
Type
Description
<
expression1
>, <
expression2
>, ...
Yes
Boolean
The expressions to check
Return value
Type
Description
true or false
Boolean
Return 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
.
Return an array from a single specified input.
For multiple inputs, see
createArray()
.
array('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string for creating an array
Return value
Type
Description
[<
value
>]
Array
An array that contains the single specified input
Example
This example creates an array from the "hello" string:
array('hello')
And returns this result:
["hello"]
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The input string
Return value
Type
Description
<
base64-string
>
String
The 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="
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The base64-encoded string to convert
Return value
Type
Description
<
binary-for-base64-string
>
String
The 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.
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The base64-encoded string to decode
Return value
Type
Description
<
decoded-base64-string
>
String
The 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"
Return the base64-encoded binary version of a string.
binary('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string to convert
Return value
Type
Description
<
binary-for-input-value
>
String
The 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.
Return an action's
body
output at runtime. Shorthand for
actions('<actionName>').outputs.body
. See
actions()
.
body('<actionName>')
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The name for the action's
body
output that you want
Return value
Type
Description
<
action-body-output
>
String
The
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"
}
Return the Boolean version of a value.
bool(<value>)
Parameter
Required
Type
Description
<
value
>
Yes
Any
The 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 value
Type
Description
true
or
false
Boolean
The Boolean version of the specified value.
Outputs
These examples show the different supported types of input for
bool()
:
Input value
Type
Return value
bool(1)
Integer
true
bool(0)
Integer
false
bool(-1)
Integer
true
bool('true')
String
true
bool('false')
String
false
Split a string or array into chunks of equal length.
chunk('<collection>', '<length>')
chunk([<collection>], '<length>')
Parameter
Required
Type
Description
<
collection
>
Yes
String or Array
The collection to split
<
length
>
Yes
The length of each chunk
Return value
Type
Description
<
collection
>
Array
An 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] ]
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>, ...)
Parameter
Required
Type
Description
<
object_1
>, <
object_2
>, ...
Yes
Any, can mix types
One or more items to check for null
Return value
Type
Description
<
first-non-null-item
>
Any
The 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
Combine two or more strings, and return the combined string.
concat('<text1>', '<text2>', ...)
Parameter
Required
Type
Description
<
text1
>, <
text2
>, ...
Yes
String
At least two strings to combine
Return value
Type
Description
<
text1text2...
>
String
The 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"
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
Parameter
Required
Type
Description
<
collection
>
Yes
String, Array, or Dictionary
The collection to check
<
value
>
Yes
String, Array, or Dictionary, respectively
The item to find
Return value
Type
Description
true or false
Boolean
Return 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')
Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
convertFromUtc('<timestamp>', '<destinationTimeZone>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
destinationTimeZone
>
Yes
String
The name for the target time zone. For time zone names, review
Microsoft Windows Default Time Zones
.
<
format
>
No
String
A 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 value
Type
Description
<
converted-timestamp
>
String
The 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"
Convert a timestamp from the source time zone to the target time zone.
convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
sourceTimeZone
>
Yes
String
The 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
>
Yes
String
The 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
>
No
String
A 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 value
Type
Description
<
converted-timestamp
>
String
The 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"
Convert a timestamp from the source time zone to Universal Time Coordinated (UTC).
convertToUtc('<timestamp>', '<sourceTimeZone>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
sourceTimeZone
>
Yes
String
The 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
>
No
String
A 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 value
Type
Description
<
converted-timestamp
>
String
The 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"
Return an array from multiple inputs.
For single input arrays, see
array()
.
createArray('<object1>', '<object2>', ...)
Parameter
Required
Type
Description
<
object1
>, <
object2
>, ...
Yes
Any, but not mixed
At least two items to create the array
Return value
Type
Description
[<
object1
>, <
object2
>, ...]
Array
The 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"]
Return a data uniform resource identifier (URI) for a string.
dataUri('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string to convert
Return value
Type
Description
<
data-uri
>
String
The 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="
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The data URI to convert
Return value
Type
Description
<
binary-for-data-uri
>
String
The 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"
Return the string version for a data uniform resource identifier (URI).
dataUriToString('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The data URI to convert
Return value
Type
Description
<
string-for-data-uri
>
String
The 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"
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>')
Parameter
Required
Type
Description
<
startDate
>
Yes
String
A string that contains a timestamp
<
endDate
>
Yes
String
A string that contains a timestamp
Return value
Type
Description
<
timespan
>
String
The 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"
Return the day of the month from a timestamp.
dayOfMonth('<timestamp>')
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
Return value
Type
Description
<
day-of-month
>
Integer
The 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
Return the day of the week from a timestamp.
dayOfWeek('<timestamp>')
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
Return value
Type
Description
<
day-of-week
>
Integer
The 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
Return the day of the year from a timestamp.
dayOfYear('<timestamp>')
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
Return value
Type
Description
<
day-of-year
>
Integer
The 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
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The decimal number in a string
Return value
Type
Description
<
decimal
>
Decimal Number
The 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".
This function is deprecated, so use
base64ToString()
instead.
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The data URI string to decode
Return value
Type
Description
<
binary-for-data-uri
>
String
The 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:
"hello"
Return a string that replaces escape characters with decoded versions.
decodeUriComponent('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string with the escape characters to decode
Return value
Type
Description
<
decoded-uri
>
String
The 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"
Return the result from dividing two numbers. To get the remainder result, see
mod()
.
div(<dividend>, <divisor>)
Parameter
Required
Type
Description
<
dividend
>
Yes
Integer or Float
The number to divide by the
divisor
<
divisor
>
Yes
Integer or Float
The number that divides the
dividend
, but can't be zero
Return value
Type
Description
<
quotient-result
>
Integer or Float
The 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)
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string to convert to URI-encoded format
Return value
Type
Description
<
encoded-uri
>
String
The 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"
Check whether a collection is empty.
Return true when the collection is empty,
or return false when not empty.
empty('<collection>')
empty([<collection>])
Parameter
Required
Type
Description
<
collection
>
Yes
String, Array, or Object
The collection to check
Return value
Type
Description
true or false
Boolean
Return 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
.
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string to check
<
searchText
>
Yes
String
The ending substring to find
Return value
Type
Description
true or false
Boolean
Return 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
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>')
Parameter
Required
Type
Description
<
object1
>, <
object2
>
Yes
Various
The values, expressions, or objects to compare
Return value
Type
Description
true or false
Boolean
Return 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
.
Return the first item from a string or array.
first('<collection>')
first([<collection>])
Parameter
Required
Type
Description
<
collection
>
Yes
String or Array
The collection where to find the first item
Return value
Type
Description
<
first-collection-item
>
Any
The 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
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>'?)
Parameter
Required
Type
Description
<
value
>
Yes
String
The 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
>
No
String
The 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 value
Type
Description
<
float-value
>
Float
The 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
Example 3
Examples of unexpectedly valid inputs:
float('12,3,4,5678') //Returns 12345678
float('1234567,8+') //Returns 12345678
float('12345,6,78,-') //Returns -12345678
float('-12,345,678,') //Returns -12345678
float('12345678.-') //Returns -12345678
float('.12345678') //Returns 0.12345678
Return a timestamp in the specified format.
formatDateTime('<timestamp>', '<format>'?, '<locale>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
format
>
No
String
A 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
>
No
String
The locale to use. If unspecified, the value is
en-us
. If
locale
isn't a valid value, an error is generated.
Return value
Type
Description
<
reformatted-timestamp
>
String
The 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'.
Return an array with values that match a key name
in an action's
form-data
or
form-encoded
output.
formDataMultiValues('<actionName>', '<key>')
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The action whose output has the key value you want
<
key
>
Yes
String
The name for the key whose value you want
Return value
Type
Description
[<
array-with-key-values
>]
Array
An 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"]
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>')
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The action whose output has the key value you want
<
key
>
Yes
String
The name for the key whose value you want
Return value
Type
Description
<
key-value
>
String
The 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"
Return a number as a string that's based on the specified format.
formatNumber(<number>, <format>, <locale>?)
Parameter
Required
Type
Description
<
number
>
Yes
Integer or Double
The value that you want to format.
<
format
>
Yes
String
A 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
>
No
String
The 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 value
Type
Description
<
formatted-number
>
String
The 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.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.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')
Return the current timestamp plus the specified time units.
getFutureTime(<interval>, <timeUnit>, <format>?)
Parameter
Required
Type
Description
<
interval
>
Yes
Integer
The number of time units to add
<
timeUnit
>
Yes
String
The unit of time to use with
interval
: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<
format
>
No
String
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 that the provided format isn't valid and must be a numeric format string.
Return value
Type
Description
<
updated-timestamp
>
String
The 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"
Return the current timestamp minus the specified time units.
getPastTime(<interval>, <timeUnit>, <format>?)
Parameter
Required
Type
Description
<
interval
>
Yes
Integer
The number of specified time units to subtract
<
timeUnit
>
Yes
String
The unit of time to use with
interval
: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<
format
>
No
String
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 that the provided format isn't valid and must be a numeric format string.
Return value
Type
Description
<
updated-timestamp
>
String
The 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"
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>')
Parameter
Required
Type
Description
<
value
>
Yes
Integer, Float, or String
The first value to check whether greater than the second value
<
compareTo
>
Yes
Integer, Float, or String, respectively
The comparison value
Return value
Type
Description
true or false
Boolean
Return 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
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>')
Parameter
Required
Type
Description
<
value
>
Yes
Integer, Float, or String
The first value to check whether greater than or equal to the second value
<
compareTo
>
Yes
Integer, Float, or String, respectively
The comparison value
Return value
Type
Description
true or false
Boolean
Return 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
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>')
Parameter
Required
Type
Description
<
format
>
No
String
A single
format specifier
for the returned GUID. By default, the format is "D", but you can use "N", "D", "B", "P", or "X".
Return value
Type
Description
<
GUID-value
>
String
A 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)"
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>)
Parameter
Required
Type
Description
<
expression
>
Yes
Boolean
The expression to check
<
valueIfTrue
>
Yes
Any
The value to return when the expression is true
<
valueIfFalse
>
Yes
Any
The value to return when the expression is false
Return value
Type
Description
<
specified-return-value
>
Any
The 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')
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that has the substring to find
<
searchText
>
Yes
String
The substring to find
Return value
Type
Description
<
index-value
>
Integer
The 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
Convert the string version for an integer to an actual integer number.
int('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string version for the integer to convert. The minimum and maximum values are the same as the limits for the integer data type.
Return value
Type
Description
<
integer-result
>
Integer
The 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
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>'?)
Parameter
Required
Type
Description
<
value
>
Yes
String
The string to examine
<
locale
>
No
String
The RFC 4646 locale code to use
Return value
Type
Description
<
boolean-result
>
Boolean
A 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
Return a boolean that indicates whether a string is an integer.
isInt('<string>')
Parameter
Required
Type
Description
<
string
>
Yes
String
The string to examine
Return value
Type
Description
<
boolean-result
>
Boolean
A 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
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 value
Type
Description
<
current-array-item
>
Any
The 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
Return the current item from each cycle in a for-each loop.
Use this function inside the for-each loop.
items('<loopName>')
Parameter
Required
Type
Description
<
loopName
>
Yes
String
The name for the for-each loop
Return value
Type
Description
<
item
>
Any
The 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')
Return the index value for the current iteration inside an Until loop. You can use this function inside nested Until loops.
iterationIndexes('<loopName>')
Parameter
Required
Type
Description
<
loopName
>
Yes
String
The name for the Until loop
Return value
Type
Description
<
index
>
Integer
The 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"
]
}
}
}
}
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.
Parameter
Required
Type
Description
<
value
>
Yes
String or XML
The string or XML to convert
Return value
Type
Description
<
JSON-result
>
JSON native type, object, or array
The 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"
}
]
}
}
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>', ...)
Parameter
Required
Type
Description
<
collection1
>, <
collection2
>, ...
Yes
Array or Object, but not both
The collections from where you want
only
the common items
Return value
Type
Description
<
common-items
>
Array or Object, respectively
A 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]
Return a string that has all the items from an array
and has each character separated by a
delimiter
.
join([<collection>], '<delimiter>')
Parameter
Required
Type
Description
<
collection
>
Yes
Array
The array that has the items to join
<
delimiter
>
Yes
String
The separator that appears between each character in the resulting string
Return value
Type
Description
<
char1
><
delimiter
><
char2
><
delimiter
>...
String
The 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"
Return the last item from a collection.
last('<collection>')
last([<collection>])
Parameter
Required
Type
Description
<
collection
>
Yes
String or Array
The collection where to find the last item
Return value
Type
Description
<
last-collection-item
>
String or Array, respectively
The 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
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that has the substring to find
<
searchText
>
Yes
String
The substring to find
Return value
Type
Description
<
ending-index-value
>
Integer
The 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', '')
Return the number of items in a collection.
length('<collection>')
length([<collection>])
Parameter
Required
Type
Description
<
collection
>
Yes
String or Array
The collection with the items to count
Return value
Type
Description
<
length-or-count
>
Integer
The 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
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>')
Parameter
Required
Type
Description
<
value
>
Yes
Integer, Float, or String
The first value to check whether less than the second value
<
compareTo
>
Yes
Integer, Float, or String, respectively
The comparison item
Return value
Type
Description
true or false
Boolean
Return 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
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>')
Parameter
Required
Type
Description
<
value
>
Yes
Integer, Float, or String
The first value to check whether less than or equal to the second value
<
compareTo
>
Yes
Integer, Float, or String, respectively
The comparison item
Return value
Type
Description
true or false
Boolean
Return 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
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 value
Type
Description
<
callback-URL
>
String
The 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*>"
Return the highest value from a list or array with
numbers that is inclusive at both ends.
max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
Parameter
Required
Type
Description
<
number1
>, <
number2
>, ...
Yes
Integer, Float, or both
The set of numbers from which you want the highest value
[<
number1
>, <
number2
>, ...]
Yes
Array - Integer, Float, or both
The array of numbers from which you want the highest value
Return value
Type
Description
<
max-value
>
Integer or Float
The 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
Return the lowest value from a set of numbers or an array.
min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
Parameter
Required
Type
Description
<
number1
>, <
number2
>, ...
Yes
Integer, Float, or both
The set of numbers from which you want the lowest value
[<
number1
>, <
number2
>, ...]
Yes
Array - Integer, Float, or both
The array of numbers from which you want the lowest value
Return value
Type
Description
<
min-value
>
Integer or Float
The 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
Return the remainder from dividing two numbers.
To get the integer result, see
div()
.
mod(<dividend>, <divisor>)
Parameter
Required
Type
Description
<
dividend
>
Yes
Integer or Float
The number to divide by the
divisor
<
divisor
>
Yes
Integer or Float
The number that divides the
dividend
, but can't be zero
Return value
Type
Description
<
modulo-result
>
Integer or Float
The 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
Return the product from multiplying two numbers.
mul(<multiplicand1>, <multiplicand2>)
Parameter
Required
Type
Description
<
multiplicand1
>
Yes
Integer or Float
The number to multiply by
multiplicand2
<
multiplicand2
>
Yes
Integer or Float
The number that multiples
multiplicand1
Return value
Type
Description
<
product-result
>
Integer or Float
The 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
Return the body for a specific part in an
action's output that has multiple parts.
multipartBody('<actionName>', <index>)
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The name for the action that has output with multiple parts
<
index
>
Yes
Integer
The index value for the part that you want
Return value
Type
Description
<
body
>
String
The body for the specified part
Check whether an expression is false.
Return true when the expression is false,
or return false when true.
not(<expression>)
Parameter
Required
Type
Description
<
expression
>
Yes
Boolean
The expression to check
Return value
Type
Description
true or false
Boolean
Return 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
.
Return the starting position or index value where the
n
th occurrence of a substring appears in a string.
nthIndexOf('<text>', '<searchText>', <occurrence>)
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that contains the substring to find
<
searchText
>
Yes
String
The substring to find
<
occurrence
>
Yes
Integer
A number that specifies the
n
th occurrence of the substring to find. If
occurrence
is negative, start searching from the end.
Return value
Type
Description
<
index-value
>
Integer
The starting position or index value for the
n
th 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`.
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>, ...)
Parameter
Required
Type
Description
<
expression1
>, <
expression2
>, ...
Yes
Boolean
The expressions to check
Return value
Type
Description
true or false
Boolean
Return 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
.
Return an action's outputs at runtime.
outputs('<actionName>')
Parameter
Required
Type
Description
<
actionName
>
Yes
String
The name for the action's output that you want
Return value
Type
Description
<
output
>
String
The 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"
}
}
Return the value for a parameter that is described in your workflow definition.
parameters('<parameterName>')
Parameter
Required
Type
Description
<
parameterName
>
Yes
String
The name for the parameter whose value you want
Return value
Type
Description
<
parameter-value
>
Any
The 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"
Return the timestamp from a string that contains a timestamp.
parseDateTime('<timestamp>', '<locale>'?, '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
locale
>
No
String
The locale to use.
If not specified, the default locale is
en-us
.
If
locale
isn't a valid value, an error is generated.
<
format
>
No
String
A 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 value
Type
Description
<
parsed-timestamp
>
String
The 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'.
Return a random integer from a specified range, which is inclusive only at the starting end.
rand(<minValue>, <maxValue>)
Parameter
Required
Type
Description
<
minValue
>
Yes
Integer
The lowest integer in the range
<
maxValue
>
Yes
Integer
The integer that follows the highest integer in the range that the function can return
Return value
Type
Description
<
random-result
>
Integer
The 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
Return an integer array that starts from a specified integer.
range(<startIndex>, <count>)
Parameter
Required
Type
Description
<
startIndex
>
Yes
Integer
An integer value that starts the array as the first item
<
count
>
Yes
Integer
The 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 value
Type
Description
[<
range-result
>]
Array
The 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]
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>')
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object from where you want to remove a property
<
property
>
Yes
String
The name for the property to remove
Return value
Type
Description
<
updated-object
>
Object
The 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>')
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object whose property you want to remove
<
parent-property
>
Yes
String
The name for parent property with the child property that you want to remove
<
child-property
>
Yes
String
The name for the child property to remove
Return value
Type
Description
<
updated-object
>
Object
The 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 a substring with the specified string, and return the result string. This function is case-sensitive.
replace('<text>', '<oldText>', '<newText>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that has the substring to replace
<
oldText
>
Yes
String
The substring to replace
<
newText
>
Yes
String
The replacement string
Return value
Type
Description
<
updated-text
>
String
The 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"
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>')
Parameter
Required
Type
Description
<
scopedActionName
>
Yes
String
The name of the scoped action where you want the inputs and outputs from the top-level actions inside that scope
Return value
Type
Description
<
array-object
>
Array object
An 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 the order of items in a collection. When you use this function with
sort()
, you can sort a collection in descending order.
reverse([<collection>])
Parameter
Required
Type
Description
<
collection
>
Yes
Array
The collection to reverse
Return value
Type
Description
[<
updated-collection
>]
Array
The reversed collection
Example
This example reverses an array of integers:
reverse(createArray(0, 1, 2, 3))
And returns this array:
[3,2,1,0]
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>)
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object whose property you want to set
<
property
>
Yes
String
The name for the existing or new property to set
<
value
>
Yes
Any
The 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>))
Parameter
Required
Type
Description
<
object
>
Yes
Object
The JSON object whose property you want to set
<
parent-property
>
Yes
String
The name for parent property with the child property that you want to set
<
child-property
>
Yes
String
The name for the child property to set
<
value
>
Yes
Any
The value to set for the specified property
Return value
Type
Description
<
updated-object
>
Object
The 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"
}
}
Remove items from the front of a collection, and return
all the other
items.
skip([<collection>], <count>)
Parameter
Required
Type
Description
<
collection
>
Yes
Array
The collection whose items you want to remove
<
count
>
Yes
Integer
A positive integer for the number of items to remove at the front
Return value
Type
Description
[<
updated-collection
>]
Array
The 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]
Return a substring by specifying the starting and ending position or value.
See also
substring()
.
slice('<text>', <startIndex>, <endIndex>?)
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that contains the substring to find
<
startIndex
>
Yes
Integer
The 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
>
No
Integer
The 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 value
Type
Description
<
slice-result
>
String
A 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 items in a collection. You can sort the collection objects using any key that contains a primitive data type supported by the Workflow Definition Language, such as
int
,
float
,
string
, or
bool
.
sort([<collection>], <sortBy>?)
Parameter
Required
Type
Description
<
collection
>
Yes
Array
The collection with the items to sort
<
sortBy
>
No
String
The key to use for sorting the collection objects
Return value
Type
Description
[<
updated-collection
>]
Array
The 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" }')]
Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.
split('<text>', '<delimiter>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string to separate into substrings based on the specified delimiter in the original string
<
delimiter
>
Yes
String
The character in the original string to use as the delimiter
Return value
Type
Description
[<
substring1
>,<
substring2
>,...]
Array
An 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"]
Return the start of the day for a timestamp.
startOfDay('<timestamp>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Return the start of the hour for a timestamp.
startOfHour('<timestamp>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Return the start of the month for a timestamp.
startOfMonth('<timestamp>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string to check
<
searchText
>
Yes
String
The starting string to find
Return value
Type
Description
true or false
Boolean
Return 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
Return the string version for a value.
string(<value>)
Parameter
Required
Type
Description
<
value
>
Yes
Any
The 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 value
Type
Description
<
string-value
>
String
The 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\\" }"
Return the result from subtracting the second number from the first number.
sub(<minuend>, <subtrahend>)
Parameter
Required
Type
Description
<
minuend
>
Yes
Integer or Float
The number from which to subtract the
subtrahend
<
subtrahend
>
Yes
Integer or Float
The number to subtract from the
minuend
Return value
Type
Description
<
result
>
Integer or Float
The 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
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>)
Parameter
Required
Type
Description
<
text
>
Yes
String
The string whose characters you want
<
startIndex
>
Yes
Integer
A positive number equal to or greater than 0 that you want to use as the starting position or index value
<
length
>
No
Integer
A 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 value
Type
Description
<
substring-result
>
String
A 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"
Subtract a number of time units from a timestamp. See also
getPastTime
.
subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string that contains the timestamp
<
interval
>
Yes
Integer
The number of specified time units to subtract
<
timeUnit
>
Yes
String
The unit of time to use with
interval
: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"
<
format
>
No
String
A 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 value
Type
Description
<
updated-timestamp
>
String
The 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"
Return items from the front of a collection.
take('<collection>', <count>)
take([<collection>], <count>)
Parameter
Required
Type
Description
<
collection
>
Yes
String or Array
The collection whose items you want
<
count
>
Yes
Integer
A positive integer for the number of items that you want from the front
Return value
Type
Description
<
subset
> or [<
subset
>]
String or Array, respectively
A 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]
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>')
Parameter
Required
Type
Description
<
timestamp
>
Yes
String
The string for a timestamp
Return value
Type
Description
<
ticks-number
>
Integer
The number of ticks since the specified timestamp
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string to return in lowercase format
Return value
Type
Description
<
lowercase-text
>
String
The original string in lowercase format
Example
This example converts this string to lowercase:
toLower('Hello World')
And returns this result:
"hello world"
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>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string to return in uppercase format
Return value
Type
Description
<
uppercase-text
>
String
The original string in uppercase format
Example
This example converts this string to uppercase:
toUpper('Hello World')
And returns this result:
"HELLO WORLD"
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 value
Type
Description
<
trigger-output
>
String
The output from a trigger at runtime
Return a trigger's
body
output at runtime. Shorthand for
trigger().outputs.body
. See
trigger()
.
triggerBody()
Return value
Type
Description
<
trigger-body-output
>
String
The
body
output from the trigger
Return an array with values that match a key name in a trigger's
form-data
or
form-encoded
output.
triggerFormDataMultiValues('<key>')
Parameter
Required
Type
Description
<
key
>
Yes
String
The name for the key whose value you want
Return value
Type
Description
[<
array-with-key-values
>]
Array
An 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"]
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>')
Parameter
Required
Type
Description
<
key
>
Yes
String
The name for the key whose value you want
Return value
Type
Description
<
key-value
>
String
The 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"
Return the body for a specific part in a trigger's output that has multiple parts.
triggerMultipartBody(<index>)
Parameter
Required
Type
Description
<
index
>
Yes
Integer
The index value for the part that you want
Return value
Type
Description
<
body
>
String
The body for the specified part in a trigger's multipart output
Return a trigger's output at runtime, or values from other JSON name-and-value pairs. Shorthand for
trigger().outputs
. See
trigger()
.
triggerOutputs()
Return value
Type
Description
<
trigger-output
>
String
The output from a trigger at runtime
Remove leading and trailing whitespace from a string, and return the updated string.
trim('<text>')
Parameter
Required
Type
Description
<
text
>
Yes
String
The string that has the leading and trailing whitespace to remove
Return value
Type
Description
<
updatedText
>
String
An 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"
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>], ...)
Parameter
Required
Type
Description
<
collection1
>, <
collection2
>, ...
Yes
Array or Object, but not both
The collections from where you want
all
the items
Return value
Type
Description
<
updatedCollection
>
Array or Object, respectively
A 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]
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>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The string to convert to URI-encoded format
Return value
Type
Description
<
encoded-uri
>
String
The 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"
Return the binary version for a uniform resource identifier (URI) component.
uriComponentToBinary('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The URI-encoded string to convert
Return value
Type
Description
<
binary-for-encoded-uri
>
String
The 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:
"aHR0cHM6Ly9jb250b3NvLmNvbQ=="
Return the string version for a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.
uriComponentToString('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The URI-encoded string to decode
Return value
Type
Description
<
decoded-uri
>
String
The 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"
Return the
host
value for a uniform resource identifier (URI).
uriHost('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
host
value you want
Return value
Type
Description
<
host-value
>
String
The
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"
Return the
path
value for a uniform resource identifier (URI).
uriPath('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
path
value you want
Return value
Type
Description
<
path-value
>
String
The
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"
Return the
path
and
query
values for a uniform resource identifier (URI).
uriPathAndQuery('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
path
and
query
values you want
Return value
Type
Description
<
path-query-value
>
String
The
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"
Return the
port
value for a uniform resource identifier (URI).
uriPort('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
port
value you want
Return value
Type
Description
<
port-value
>
Integer
The
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
Return the
query
value for a uniform resource identifier (URI).
uriQuery('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
query
value you want
Return value
Type
Description
<
query-value
>
String
The
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"
Return the
scheme
value for a uniform resource identifier (URI).
uriScheme('<uri>')
Parameter
Required
Type
Description
<
uri
>
Yes
String
The URI whose
scheme
value you want
Return value
Type
Description
<
scheme-value
>
String
The
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"
Return the current timestamp.
utcNow('<format>')
Optionally, you can specify a different format with the <
format
> parameter.
Parameter
Required
Type
Description
<
format
>
No
String
A 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 value
Type
Description
<
current-timestamp
>
String
The current date and time
Examples
utcNow() // Returns 2025-09-25T05:18:31.3384797Z
utcNow('u') // Returns 2025-09-25 05:18:31Z
utcNow('U') // Returns Thursday, September 25, 2025 5:18:31 AM
utcNow('d') // Returns 9/25/2025
utcNow('D') // Returns Thursday, September 25, 2025
utcNow('t') // Returns 5:18 AM
utcNow('T') // Returns 5:18:31 AM
utcNow('y') // Returns September 2025
utcNow('yyyy') // Returns 2025
utcNow('ddd, d MMM yyyy') // Returns Thu, 25 Sep 2025
Return the value for a specified variable.
variables('<variableName>')
Parameter
Required
Type
Description
<
variableName
>
Yes
String
The name for the variable whose value you want
Return value
Type
Description
<
variable-value
>
Any
The 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
Return all the details about the workflow itself during run time.
workflow().<property>
Parameter
Required
Type
Description
<
property
>
No
String
The 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>
Return the XML version for a string that contains a JSON object.
xml('<value>')
Parameter
Required
Type
Description
<
value
>
Yes
String
The 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 value
Type
Description
<
xml-version
>
Object
The 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
>
Example 4
The
xml()
function expects either an object or a string containing valid XML. The function doesn't accept a raw array as input.
If you have a JSON array, like the following example, you have four options.
[
{
"ID"
:
1
,
"Name"
:
"James"
},
{
"ID"
:
2
,
"Name"
:
"John"
},
{
"ID"
:
3
,
"Name"
:
"Sam"
}
]
Option 1: Convert the JSON string to a JSON object before you pass the result to the
xml()
function, for example:
xml(
json('{"root":{"array":[
{ "ID": 1, "Name": "James" },
{ "ID": 2, "Name": "John" },
{ "ID": 3, "Name": "Sam" }
]}}')
)
Option 2: Store the JSON array in a
Compose
action named
Compose1
. Then use the
outputs()
function to return a JSON object from
Compose1
, and store the returned JSON object in another
Compose
action named
Compose2
.
{
"root": { "array": @{outputs('Compose1')} }
}
You can then use the
xml()
and
outputs()
functions to create XML from the JSON object output from
Compose2
, for example:
xml(outputs('Compose2'))
Option 3: Store the JSON array in a
Compose
action named
Compose1
. Then use the
outputs()
,
concat()
,
json()
, and
xml()
functions to create XML from the JSON object output, for example:
xml(
json(
concat(
'{"root":{"array":',
outputs('Compose1'),
'}}'
)
)
)
Option 4: Similar to option 3, but uses
addProperty()
instead of the
concat()
function to create the JSON object before passing it to the
xml()
function, for example:
xml(
addProperty(
json('{}'),
'root',
addProperty(
json('{}'),
'array',
outputs('Compose1')
)
)
)
All the examples from options 1 to 4 return the following XML result:
<
root
>
<
array
>
<
ID
>
1
</
ID
>
<
Name
>
James
</
Name
>
</
array
>
<
array
>
<
ID
>
2
</
ID
>
<
Name
>
John
</
Name
>
</
array
>
<
array
>
<
ID
>
3
</
ID
>
<
Name
>
Sam
</
Name
>
</
array
>
</
root
>
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>')
Parameter
Required
Type
Description
<
xml
>
Yes
Any
The XML string to search for nodes or values that match an XPath expression value
<
xpath
>
Yes
Any
The XPath expression used to find matching XML nodes or values
Return value
Type
Description
<
xml-node
>
XML
An XML node when only a single node matches the specified XPath expression
<
value
>
Any
The value from an XML node when only a single value matches the specified XPath expression
[<
xml-node1
>, <
xml-node2
>, ...] -or- [<
value1
>, <
value2
>, ...]
Array
An 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
>
<
name
expired
=
'true'
>
Gala
</
name
>
<
type
>
apple
</
type
>
<
count
>
20
</
count
>
</
item
>
<
item
>
<
name
expired
=
'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
>
<
name
expired
=
'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
>
<
name
expired
=
'true'
price
=
'12'
>
Gala
</
name
>
<
type
>
apple
</
type
>
<
count
>
20
</
count
>
</
item
>
<
item
>
<
name
expired
=
'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"?>
<
file
xmlns
=
"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
Learn about the
Workflow Definition Language |
| Markdown | [Skip to main content](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#main) [Skip to Ask Learn chat experience](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
## Microsoft Build 2026
June 2-3, 2026
Go deep on real code and real systems in San Francisco and online
[Learn more](https://aka.ms/MSBuild_FY26_BN_MSLearn_Hero)
Dismiss alert
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
[Download Microsoft Edge](https://go.microsoft.com/fwlink/p/?LinkID=2092881%20) [More info about Internet Explorer and Microsoft Edge](https://learn.microsoft.com/en-us/lifecycle/faq/internet-explorer-microsoft-edge)
[Learn](https://learn.microsoft.com/en-us/)
[Sign in](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
![]()
![]()
- [Profile](https://learn.microsoft.com/en-us/users/me/activity/)
- [Settings](https://learn.microsoft.com/en-us/users/me/settings/)
[Sign out](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
[Learn](https://learn.microsoft.com/en-us/)
- Documentation
- [All product documentation](https://learn.microsoft.com/en-us/docs/)
- [Azure documentation](https://learn.microsoft.com/en-us/azure/?product=popular)
- [Dynamics 365 documentation](https://learn.microsoft.com/en-us/dynamics365/)
- [Microsoft Copilot documentation](https://learn.microsoft.com/en-us/copilot/)
- [Microsoft 365 documentation](https://learn.microsoft.com/en-us/microsoft-365/)
- [Power Platform documentation](https://learn.microsoft.com/en-us/power-platform/)
- [Code samples](https://learn.microsoft.com/en-us/samples/)
- [Troubleshooting documentation](https://learn.microsoft.com/en-us/troubleshoot/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Training & Labs
- [All training](https://learn.microsoft.com/en-us/training/)
- [Azure training](https://learn.microsoft.com/en-us/training/browse/?products=azure)
- [Dynamics 365 training](https://learn.microsoft.com/en-us/training/browse/?products=dynamics-365)
- [Microsoft Copilot training](https://learn.microsoft.com/en-us/training/browse/?products=ms-copilot)
- [Microsoft 365 training](https://learn.microsoft.com/en-us/training/browse/?products=m365)
- [Microsoft Power Platform training](https://learn.microsoft.com/en-us/training/browse/?products=power-platform)
- [Labs](https://learn.microsoft.com/en-us/labs/)
- [Credentials](https://learn.microsoft.com/en-us/credentials/)
- [Career paths](https://learn.microsoft.com/en-us/training/career-paths/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Q\&A
- [Ask a question](https://learn.microsoft.com/en-us/answers/questions/ask/)
- [Azure questions](https://learn.microsoft.com/en-us/answers/tags/133/azure/)
- [Windows questions](https://learn.microsoft.com/en-us/answers/tags/60/windows/)
- [Microsoft 365 questions](https://learn.microsoft.com/en-us/answers/tags/9/m365/)
- [Microsoft Outlook questions](https://learn.microsoft.com/en-us/answers/tags/131/office-outlook/)
- [Microsoft Teams questions](https://learn.microsoft.com/en-us/answers/tags/108/office-teams/)
- [Popular tags](https://learn.microsoft.com/en-us/answers/tags/)
- [All questions](https://learn.microsoft.com/en-us/answers/questions/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Topics
- [Artificial intelligence](https://learn.microsoft.com/en-us/ai/)
Learning hub to build AI skills
- [Compliance](https://learn.microsoft.com/en-us/compliance/)
Compliance resources you need to get started with your business
- [DevOps](https://learn.microsoft.com/en-us/devops/)
DevOps practices, Git version control and Agile methods
- [Learn for Organizations](https://learn.microsoft.com/en-us/training/organizations/)
Curated offerings from Microsoft to boost your team’s technical skills
- [Platform engineering](https://learn.microsoft.com/en-us/platform-engineering/)
Tools from Microsoft and others to build personalized developer experiences
- [Security](https://learn.microsoft.com/en-us/security/)
Guidance to help you tackle security challenges
- [Assessments](https://learn.microsoft.com/en-us/assessments/)
Interactive guidance with custom recommendations
- [Student hub](https://learn.microsoft.com/en-us/training/student-hub/)
Self-paced and interactive training for students
- [Educator center](https://learn.microsoft.com/en-us/training/educator-center/)
Resources for educators to bring technical innovation in their classroom
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
[Sign in](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
![]()
![]()
- [Profile](https://learn.microsoft.com/en-us/users/me/activity/)
- [Settings](https://learn.microsoft.com/en-us/users/me/settings/)
[Sign out](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
[Azure](https://learn.microsoft.com/en-us/azure/)
- Products
- Popular products
- [Microsoft Foundry](https://learn.microsoft.com/en-us/azure/ai-foundry/)
- [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)
- [Azure Databricks](https://learn.microsoft.com/en-us/azure/databricks/)
- [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/)
- [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)
- [Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/)
- [Azure Virtual Machines](https://learn.microsoft.com/en-us/azure/virtual-machines/)
- Popular categories
- [Compute](https://learn.microsoft.com/en-us/azure/?product=compute)
- [Networking](https://learn.microsoft.com/en-us/azure/?product=networking)
- [Storage](https://learn.microsoft.com/en-us/azure/?product=storage)
- [AI & machine learning](https://learn.microsoft.com/en-us/azure/?product=ai-machine-learning)
- [Analytics](https://learn.microsoft.com/en-us/azure/?product=analytics)
- [Databases](https://learn.microsoft.com/en-us/azure/?product=databases)
- [Security](https://learn.microsoft.com/en-us/azure/?product=security)
- [View all products](https://learn.microsoft.com/en-us/azure/)
- Architecture
- [Cloud Adoption Framework](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/)
- [Well-Architected Framework](https://learn.microsoft.com/en-us/azure/well-architected/)
- [Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/)
- Develop
- [Python](https://learn.microsoft.com/en-us/azure/developer/python/)
- [.NET](https://learn.microsoft.com/en-us/dotnet/azure/)
- [JavaScript](https://learn.microsoft.com/en-us/azure/developer/javascript/)
- [Java](https://learn.microsoft.com/en-us/azure/developer/java/)
- [PowerShell](https://learn.microsoft.com/en-us/powershell/azure/)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
- [View all developer resources](https://learn.microsoft.com/en-us/azure/developer/)
- Learn Azure
- [Start your AI learning assessment](https://learn.microsoft.com/en-us/assessments/1c032171-8ca0-4032-8962-a38a5cc424a8/)
- Top learning paths
- [Cloud concepts](https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/)
- [AI fundamentals](https://learn.microsoft.com/en-us/training/paths/get-started-with-artificial-intelligence-on-azure/)
- [Intro to generative AI](https://learn.microsoft.com/en-us/training/paths/introduction-generative-ai/)
- [Azure Architecture fundamentals](https://learn.microsoft.com/en-us/training/paths/azure-fundamentals-describe-azure-architecture-services/)
- [Earn credentials](https://learn.microsoft.com/en-us/credentials/browse/?products=azure)
- [Instructor-led courses](https://learn.microsoft.com/en-us/training/browse/?products=azure&resource_type=course)
- [View all training](https://learn.microsoft.com/en-us/training/azure/)
- [Troubleshooting](https://learn.microsoft.com/en-us/troubleshoot/azure/)
- Resources
- [Product overview](https://azure.microsoft.com/get-started)
- [Azure updates](https://azure.microsoft.com/updates)
- [Pricing information](https://azure.microsoft.com/pricing/)
- [Cost management & billing](https://learn.microsoft.com/en-us/azure/cost-management-billing/)
- [Latest blog posts](https://azure.microsoft.com/blog/)
- [Support options](https://azure.microsoft.com/support/options/)
- More
- Products
- Popular products
- [Microsoft Foundry](https://learn.microsoft.com/en-us/azure/ai-foundry/)
- [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)
- [Azure Databricks](https://learn.microsoft.com/en-us/azure/databricks/)
- [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/)
- [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)
- [Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/)
- [Azure Virtual Machines](https://learn.microsoft.com/en-us/azure/virtual-machines/)
- Popular categories
- [Compute](https://learn.microsoft.com/en-us/azure/?product=compute)
- [Networking](https://learn.microsoft.com/en-us/azure/?product=networking)
- [Storage](https://learn.microsoft.com/en-us/azure/?product=storage)
- [AI & machine learning](https://learn.microsoft.com/en-us/azure/?product=ai-machine-learning)
- [Analytics](https://learn.microsoft.com/en-us/azure/?product=analytics)
- [Databases](https://learn.microsoft.com/en-us/azure/?product=databases)
- [Security](https://learn.microsoft.com/en-us/azure/?product=security)
- [View all products](https://learn.microsoft.com/en-us/azure/)
- Architecture
- [Cloud Adoption Framework](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/)
- [Well-Architected Framework](https://learn.microsoft.com/en-us/azure/well-architected/)
- [Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/)
- Develop
- [Python](https://learn.microsoft.com/en-us/azure/developer/python/)
- [.NET](https://learn.microsoft.com/en-us/dotnet/azure/)
- [JavaScript](https://learn.microsoft.com/en-us/azure/developer/javascript/)
- [Java](https://learn.microsoft.com/en-us/azure/developer/java/)
- [PowerShell](https://learn.microsoft.com/en-us/powershell/azure/)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
- [View all developer resources](https://learn.microsoft.com/en-us/azure/developer/)
- Learn Azure
- [Start your AI learning assessment](https://learn.microsoft.com/en-us/assessments/1c032171-8ca0-4032-8962-a38a5cc424a8/)
- Top learning paths
- [Cloud concepts](https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/)
- [AI fundamentals](https://learn.microsoft.com/en-us/training/paths/get-started-with-artificial-intelligence-on-azure/)
- [Intro to generative AI](https://learn.microsoft.com/en-us/training/paths/introduction-generative-ai/)
- [Azure Architecture fundamentals](https://learn.microsoft.com/en-us/training/paths/azure-fundamentals-describe-azure-architecture-services/)
- [Earn credentials](https://learn.microsoft.com/en-us/credentials/browse/?products=azure)
- [Instructor-led courses](https://learn.microsoft.com/en-us/training/browse/?products=azure&resource_type=course)
- [View all training](https://learn.microsoft.com/en-us/training/azure/)
- [Troubleshooting](https://learn.microsoft.com/en-us/troubleshoot/azure/)
- Resources
- [Product overview](https://azure.microsoft.com/get-started)
- [Azure updates](https://azure.microsoft.com/updates)
- [Pricing information](https://azure.microsoft.com/pricing/)
- [Cost management & billing](https://learn.microsoft.com/en-us/azure/cost-management-billing/)
- [Latest blog posts](https://azure.microsoft.com/blog/)
- [Support options](https://azure.microsoft.com/support/options/)
[Portal](https://portal.azure.com/) [Get started with Azure](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn)
- [Azure Logic Apps documentation](https://learn.microsoft.com/en-us/azure/logic-apps/)
- Overview
- Quickstarts
- Consumption logic app workflows
- [Portal](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-example-consumption-workflow)
- [Portal - Templates gallery](https://learn.microsoft.com/en-us/azure/logic-apps/create-workflows-from-templates?tabs=consumption)
- [Visual Studio](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-logic-apps-with-visual-studio)
- [Visual Studio Code](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-logic-apps-visual-studio-code)
- [Bicep](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-deploy-bicep)
- [ARM template](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-deploy-azure-resource-manager-template)
- [Azure CLI](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-logic-apps-azure-cli)
- [Azure PowerShell](https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-logic-apps-azure-powershell)
- Standard logic app workflows
- [Portal](https://learn.microsoft.com/en-us/azure/logic-apps/create-single-tenant-workflows-azure-portal)
- [Portal - Templates gallery](https://learn.microsoft.com/en-us/azure/logic-apps/create-workflows-from-templates?tabs=standard)
- [Visual Studio Code](https://learn.microsoft.com/en-us/azure/logic-apps/create-standard-workflows-visual-studio-code)
- Tutorials
- Samples
- Concepts
- How-to guides
- Reference
- [Billing and pricing models](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-pricing)
- Architecture patterns
- [Managed connector reference](https://learn.microsoft.com/en-us/connectors/connector-reference/connector-reference-logicapps-connectors)
- [Built-in service provider connector reference - Standard](https://learn.microsoft.com/en-us/azure/logic-apps/connectors/built-in/reference)
- [Monitoring data reference](https://learn.microsoft.com/en-us/azure/logic-apps/monitor-logic-apps-reference)
- [Service limits and configuration](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-limits-and-config)
- [Azure CLI - Consumption](https://learn.microsoft.com/en-us/cli/azure/logic)
- [Azure CLI - Standard](https://learn.microsoft.com/en-us/cli/azure/logicapp)
- [Azure PowerShell](https://learn.microsoft.com/en-us/powershell/module/az.logicapp)
- [REST API](https://learn.microsoft.com/en-us/rest/api/logic/)
- [Resource Manager template reference](https://learn.microsoft.com/en-us/azure/templates/microsoft.logic/allversions)
- Workflow Definition Language schema
- [Workflow Definition Language schema](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-schema)
- [Trigger and action types reference](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers)
- [Reference for expression functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
- Standard Automated Test Framework
- [Azure Policy built-ins](https://learn.microsoft.com/en-us/azure/logic-apps/policy-reference)
- Resources
Download PDF
Table of contents
Exit editor mode
1. [Learn](https://learn.microsoft.com/en-us/)
2. [Azure](https://learn.microsoft.com/en-us/azure/)
3. [Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/)
1. [Learn](https://learn.microsoft.com/en-us/)
2. [Azure](https://learn.microsoft.com/en-us/azure/)
3. [Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/)
Ask Learn
Ask Learn
Focus mode
Table of contents
[Read in English](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
Add to Collections
Add to plan
[Edit](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/logic-apps/expression-functions-reference.md)
***
#### Share via
[Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference%3FWT.mc_id%3Dfacebook) [x.com](https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference%3FWT.mc_id%3Dtwitter&tw_p=tweetbutton&url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference%3FWT.mc_id%3Dtwitter) [LinkedIn](https://www.linkedin.com/feed/?shareActive=true&text=%0A%0D%0Ahttps%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference%3FWT.mc_id%3Dlinkedin) [Email](mailto:?subject=%5BShared%20Article%5D%20Reference%20for%20functions%20in%20workflow%20expressions%20-%20Azure%20Logic%20Apps%20%7C%20Microsoft%20Learn&body=%0A%0D%0Ahttps%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference%3FWT.mc_id%3Demail)
***
Copy Markdown
Print
***
Note
Access to this page requires authorization. You can try [signing in](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference) or [changing directories]().
Access to this page requires authorization. You can try [changing directories]().
# Reference guide to functions in expressions for workflows in Azure Logic Apps and Power Automate
Feedback
Summarize this article for me
## In this article
1. [Functions in expressions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#functions-in-expressions)
2. [Considerations for using functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#considerations-for-using-functions)
3. [String functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string-functions)
4. [Collection functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#collection-functions)
5. [Logical comparison functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#logical-comparison-functions)
6. [Conversion functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#conversion-functions)
7. [Implicit data type conversions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#implicit-data-type-conversions)
8. [Math functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#math-functions)
9. [Date and time functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#date-and-time-functions)
10. [Workflow functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#workflow-functions)
11. [URI parsing functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#uri-parsing-functions)
12. [Manipulation functions: JSON & XML](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#manipulation-functions-json--xml)
13. [\---------------------------------](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#---------------------------------)
14. [All functions - alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#all-functions---alphabetical-list)
15. [A](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#a)
16. [B](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#b)
17. [C](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#c)
18. [D](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#d)
19. [E](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#e)
20. [F](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#f)
21. [G](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#g)
22. [I](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#i)
23. [J](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#j)
24. [L](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#l)
25. [M](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#m)
26. [N](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#n)
27. [O](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#o)
28. [P](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#p)
29. [R](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#r)
30. [S](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#s)
31. [T](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#t)
32. [U](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#u)
33. [V](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#v)
34. [W](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#w)
35. [X](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#x)
36. [Next steps](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#next-steps)
Show 32 more
Applies to: **Azure Logic Apps (Consumption + Standard)**
For workflow definitions in [Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview) and [Power Automate](https://learn.microsoft.com/en-us/power-automate/getting-started), some [expressions](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language).
Note
This reference guide applies to both Azure Logic Apps and Power Automate, but exists in the Azure Logic Apps documentation. Although guide refers specifically to logic app workflows, these functions work for both flows in Power Automate and workflows in Azure Logic Apps. For more information about functions and expressions in Power Automate, see [Use expressions in conditions](https://learn.microsoft.com/en-us/power-automate/use-expressions-in-conditions).
For example, you can calculate values by using math functions, such as the [add()](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#add) function, when you want the sum from integers or floats. Here are other example tasks that you can perform with functions:
Expand table
| Task | Function syntax | Result |
|---|---|---|
| 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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#ordered-by-purpose), review the following tables. Or, for detailed information about each function, see the [alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#parameters) function in an expression:
JSON
Copy
```
"accountName": "@parameters('customerName')"
```
Here are some other general ways that you can use functions in expressions:
Expand table
| Task | Function 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":
JSON
Copy
```
"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":
JSON
Copy
```
"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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#alphabetical-list).
## String functions
To work with strings, you can use these string functions and also some [collection functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#collection-functions). String functions work only on strings.
Expand table
| String function | Task |
|---|---|
| [chunk](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#chunk) | Split a string or collection into chunks of equal length. |
| [concat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#concat) | Combine two or more strings, and return the combined string. |
| [endsWith](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#endswith) | Check whether a string ends with the specified substring. |
| [formatNumber](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatNumber) | Return a number as a string based on the specified format |
| [guid](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#guid) | Generate a globally unique identifier (GUID) as a string. |
| [indexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#indexof) | Return the starting position for a substring. |
| [isFloat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isFloat) | Return a boolean that indicates whether a string is a floating-point number. |
| [isInt](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isInt) | Return a boolean that indicates whether a string is an integer. |
| [lastIndexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#lastindexof) | Return the starting position for the last occurrence of a substring. |
| [length](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#length) | Return the number of items in a string or array. |
| [nthIndexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#nthIndexOf) | Return the starting position or index value where the *n*th occurrence of a substring appears in a string. |
| [replace](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#replace) | Replace a substring with the specified string, and return the updated string. |
| [slice](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#slice) | Return a substring by specifying the starting and ending position or value. See also [substring](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#substring). |
| [split](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#split) | Return an array that contains substrings, separated by commas, from a larger string based on a specified delimiter character in the original string. |
| [startsWith](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startswith) | Check whether a string starts with a specific substring. |
| [substring](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#substring) | Return characters from a string, starting from the specified position. See also [slice](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#slice). |
| [toLower](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#toLower) | Return a string in lowercase format. |
| [toUpper](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#toUpper) | Return a string in uppercase format. |
| [trim](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trim) | Remove 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.
Expand table
| Collection function | Task |
|---|---|
| [chunk](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#chunk) | Split a string or collection into chunks of equal length. |
| [contains](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#contains) | Check whether a collection has a specific item. |
| [empty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#empty) | Check whether a collection is empty. |
| [first](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#first) | Return the first item from a collection. |
| [intersection](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#intersection) | Return a collection that has *only* the common items across the specified collections. |
| [item](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#item) | If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration. |
| [join](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#join) | Return a string that has *all* the items from an array, separated by the specified character. |
| [last](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#last) | Return the last item from a collection. |
| [length](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#length) | Return the number of items in a string or array. |
| [reverse](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#reverse) | Reverse the order of items in an array. |
| [skip](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#skip) | Remove items from the front of a collection, and return *all the other* items. |
| [sort](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#sort) | Sort items in a collection. |
| [take](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#take) | Return items from the front of a collection. |
| [union](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#union) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string).
Expand table
| Logical comparison function | Task |
|---|---|
| [and](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#and) | Check whether all expressions are true. |
| [equals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#equals) | Check whether both values are equivalent. |
| [greater](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#greater) | Check whether the first value is greater than the second value. |
| [greaterOrEquals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#greaterOrEquals) | Check whether the first value is greater than or equal to the second value. |
| [if](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#if) | Check whether an expression is true or false. Based on the result, return a specified value. |
| [isFloat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isFloat) | Return a boolean that indicates whether a string is a floating-point number. |
| [isInt](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isInt) | Return a boolean that indicates whether a string is an integer. |
| [less](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#less) | Check whether the first value is less than the second value. |
| [lessOrEquals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#lessOrEquals) | Check whether the first value is less than or equal to the second value. |
| [not](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#not) | Check whether an expression is false. |
| [or](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#or) | Check 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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type). For the full reference about each function, see the [alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#implicit-data-conversions).
Expand table
| Conversion function | Task |
|---|---|
| [array](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#array) | Return an array from a single specified input. For multiple inputs, see [createArray](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#createArray). |
| [base64](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64) | Return the base64-encoded version for a string. |
| [base64ToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64ToBinary) | Return the binary version for a base64-encoded string. |
| [base64ToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64ToString) | Return the string version for a base64-encoded string. |
| [binary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#binary) | Return the binary version for an input value. |
| [bool](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#bool) | Return the Boolean version for an input value. |
| [createArray](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#createArray) | Return an array from multiple inputs. |
| [dataUri](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUri) | Return the data URI for an input value. |
| [dataUriToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUriToBinary) | Return the binary version for a data URI. |
| [dataUriToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUriToString) | Return the string version for a data URI. |
| [decimal](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decimal) | Return the decimal number for a decimal string. |
| [decodeBase64](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeBase64) | Return the string version for a base64-encoded string. |
| [decodeDataUri](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeDataUri) | Return the binary version for a data URI. |
| [decodeUriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeUriComponent) | Return a string that replaces escape characters with decoded versions. |
| [encodeUriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#encodeUriComponent) | Return a string that replaces URL-unsafe characters with escape characters. |
| [float](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#float) | Return a floating point number for an input value. |
| [int](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#int) | Return the integer version for a string. |
| [json](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#json) | Return the JavaScript Object Notation (JSON) type value or object for a string or XML. |
| [string](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#string) | Return the string version for an input value. |
| [uriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponent) | Return the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters. |
| [uriComponentToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponentToBinary) | Return the binary version for a URI-encoded string. |
| [uriComponentToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponentToString) | Return the string version for a URI-encoded string. |
| [xml](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xml) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
Expand table
| Math function | Task |
|---|---|
| [add](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#add) | Return the result from adding two numbers. |
| [div](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#div) | Return the result from dividing two numbers. |
| [max](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#max) | Return the highest value from a set of numbers or an array. |
| [min](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#min) | Return the lowest value from a set of numbers or an array. |
| [mod](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#mod) | Return the remainder from dividing two numbers. |
| [mul](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#mul) | Return the product from multiplying two numbers. |
| [rand](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#rand) | Return a random integer from a specified range. |
| [range](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#range) | Return an integer array that starts from a specified integer. |
| [sub](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#sub) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
Expand table
| Date or time function | Task |
|---|---|
| [addDays](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addDays) | Add days to a timestamp. |
| [addHours](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addHours) | Add hours to a timestamp. |
| [addMinutes](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addMinutes) | Add minutes to a timestamp. |
| [addSeconds](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addSeconds) | Add seconds to a timestamp. |
| [addToTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addToTime) | Add specified time units to a timestamp. See also [getFutureTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getFutureTime). |
| [convertFromUtc](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertFromUtc) | Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone. |
| [convertTimeZone](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertTimeZone) | Convert a timestamp from the source time zone to the target time zone. |
| [convertToUtc](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertToUtc) | Convert a timestamp from the source time zone to Universal Time Coordinated (UTC). |
| [dateDifference](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dateDifference) | Return the difference between two dates as a timespan. |
| [dayOfMonth](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfMonth) | Return the day of the month component from a timestamp. |
| [dayOfWeek](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfWeek) | Return the day of the week component from a timestamp. |
| [dayOfYear](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfYear) | Return the day of the year component from a timestamp. |
| [formatDateTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatDateTime) | Return the date from a timestamp. |
| [getFutureTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getFutureTime) | Return the current timestamp plus the specified time units. See also [addToTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addToTime). |
| [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getPastTime) | Return the current timestamp minus the specified time units. See also [subtractFromTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#subtractFromTime). |
| [parseDateTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parseDateTime) | Return the timestamp from a string that contains a timestamp. |
| [startOfDay](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfDay) | Return the start of the day for a timestamp. |
| [startOfHour](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfHour) | Return the start of the hour for a timestamp. |
| [startOfMonth](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfMonth) | Return the start of the month for a timestamp. |
| [subtractFromTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#subtractFromTime) | Subtract a number of time units from a timestamp. See also [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getPastTime). |
| [ticks](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#ticks) | Return the `ticks` property value for a specified timestamp. |
| [utcNow](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#utcNow) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
Expand table
| Workflow function | Task |
|---|---|
| [action](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#action) | Return the current action's output at runtime, or values from other JSON name-and-value pairs. See also [actions](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#actions). |
| [actions](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#actions) | Return an action's output at runtime, or values from other JSON name-and-value pairs. See also [action](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#action). |
| [body](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#body) | Return an action's `body` output at runtime. |
| [formDataMultiValues](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formDataMultiValues) | Create an array with the values that match a key name in *form-data* or *form-encoded* action outputs. |
| [formDataValue](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formDataValue) | Return a single value that matches a key name in an action's *form-data* or *form-encoded output*. |
| [item](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#item) | If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration. |
| [items](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#items) | If this function appears inside a Foreach or Until loop, return the current item from the specified loop. |
| [iterationIndexes](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#iterationIndexes) | If this function appears inside an Until loop, return the index value for the current iteration. You can use this function inside nested Until loops. |
| [listCallbackUrl](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#listCallbackUrl) | Return the "callback URL" that calls a trigger or action. |
| [multipartBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#multipartBody) | Return the body for a specific part in an action's output that has multiple parts. |
| [outputs](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#outputs) | Return an action's output at runtime. |
| [parameters](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parameters) | Return the value for a parameter that is described in your workflow definition. |
| [result](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#result) | Return the inputs and outputs from the top-level actions inside the specified scoped action, such as `For_each`, `Until`, and `Scope`. |
| [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger) | Return a trigger's output at runtime, or from other JSON name-and-value pairs. See also [triggerOutputs](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerOutputs) and [triggerBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerBody). |
| [triggerBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerBody) | Return a trigger's `body` output at runtime. See [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger). |
| [triggerFormDataValue](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerFormDataValue) | Return a single value matching a key name in *form-data* or *form-encoded* trigger outputs. |
| [triggerMultipartBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerMultipartBody) | Return the body for a specific part in a trigger's multipart output. |
| [triggerFormDataMultiValues](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerFormDataMultiValues) | Create an array whose values match a key name in *form-data* or *form-encoded* trigger outputs. |
| [triggerOutputs](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerOutputs) | Return a trigger's output at runtime, or values from other JSON name-and-value pairs. See [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger). |
| [variables](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#variables) | Return the value for a specified variable. |
| [workflow](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#workflow) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
Expand table
| URI parsing function | Task |
|---|---|
| [uriHost](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriHost) | Return the `host` value for a uniform resource identifier (URI). |
| [uriPath](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPath) | Return the `path` value for a uniform resource identifier (URI). |
| [uriPathAndQuery](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPathAndQuery) | Return the `path` and `query` values for a uniform resource identifier (URI). |
| [uriPort](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPort) | Return the `port` value for a uniform resource identifier (URI). |
| [uriQuery](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriQuery) | Return the `query` value for a uniform resource identifier (URI). |
| [uriScheme](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriScheme) | Return 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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
Expand table
| Manipulation function | Task |
|---|---|
| [addProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addProperty) | Add a property and its value, or name-value pair, to a JSON object, and return the updated object. |
| [coalesce](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#coalesce) | Return the first non-null value from one or more parameters. |
| [removeProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#removeProperty) | Remove a property from a JSON object and return the updated object. |
| [setProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#setProperty) | Set the value for a JSON object's property and return the updated object. |
| [xpath](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xpath) | Check 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()](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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
Copy
```
action()
action().outputs.body.<property>
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/rest/api/logic/workflowrunactions/get). |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*action-output*\> | Object | The JSON object 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#body). For the current action, see [action()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language).
Copy
```
actions('<actionName>')
actions('<actionName>').outputs.body.<property>
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action object whose output you want |
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/rest/api/logic/workflowrunactions/get). |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*action-output*\> | Object | The JSON object output from the specified action or property |
*Example*
This example gets the `status` property value from the X action `Get user` at runtime:
Copy
```
actions('Get_user').outputs.body.status
```
And returns this result: `"Succeeded"`
### add
Return the result from adding two numbers.
Copy
```
add(<summand_1>, <summand_2>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*summand\_1*\>, \<*summand\_2*\> | Yes | Integer, Float, or mixed | The numbers to add |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*result-sum*\> | Integer or Float | The result from adding the specified numbers |
*Example*
This example adds the specified numbers:
Copy
```
add(1, 1.5)
```
And returns this result: `2.5`
### addDays
Add days to a timestamp.
Copy
```
addDays('<timestamp>', <days>, '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*days*\> | Yes | Integer | The positive or negative number of days to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp plus the specified number of days |
*Example 1*
This example adds 10 days to the specified timestamp:
Copy
```
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:
Copy
```
addDays('2018-03-15T00:00:00Z', -5)
```
And returns this result: `"2018-03-10T00:00:00.0000000Z"`
### addHours
Add hours to a timestamp.
Copy
```
addHours('<timestamp>', <hours>, '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*hours*\> | Yes | Integer | The positive or negative number of hours to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp plus the specified number of hours |
*Example 1*
This example adds 10 hours to the specified timestamp:
Copy
```
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:
Copy
```
addHours('2018-03-15T15:00:00Z', -5)
```
And returns this result: `"2018-03-15T10:00:00.0000000Z"`
### addMinutes
Add minutes to a timestamp.
Copy
```
addMinutes('<timestamp>', <minutes>, '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*minutes*\> | Yes | Integer | The positive or negative number of minutes to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp plus the specified number of minutes |
*Example 1*
This example adds 10 minutes to the specified timestamp:
Copy
```
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:
Copy
```
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.
Copy
```
addProperty(<object>, '<property>', <value>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object where you want to add a property |
| \<*property*\> | Yes | String | The name for the property to add |
| \<*value*\> | Yes | Any | The value for the property |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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.
Copy
```
setProperty(<object>, '<parent-property>', addProperty(<object>['<parent-property>'], '<child-property>', <value>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object where you want to add a property |
| \<*parent-property*\> | Yes | String | The name for parent property where you want to add the child property |
| \<*child-property*\> | Yes | String | The name for the child property to add |
| \<*value*\> | Yes | Any | The value to set for the specified property |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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:
Copy
```
addProperty(json('{ "firstName": "Sophia", "lastName": "Owen" }'), 'middleName', 'Anne')
```
Here's the current JSON object:
JSON
Copy
```
{
"firstName": "Sophia",
"surName": "Owen"
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#json) function. The function assigns the specified value to the new property and returns the updated object:
Copy
```
setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }'), 'customerName', addProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }')['customerName'], 'middleName', 'Anne'))
```
Here's the current JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophia",
"surName": "Owen"
}
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophia",
"middleName": "Anne",
"surName": "Owen"
}
}
```
### addSeconds
Add seconds to a timestamp.
Copy
```
addSeconds('<timestamp>', <seconds>, '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*seconds*\> | Yes | Integer | The positive or negative number of seconds to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp plus the specified number of seconds |
*Example 1*
This example adds 10 seconds to the specified timestamp:
Copy
```
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:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#getFutureTime).
Copy
```
addToTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*interval*\> | Yes | Integer | The number of specified time units to add |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp plus the specified number of time units |
*Example 1*
This example adds one day to the specified timestamp:
Copy
```
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:
Copy
```
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.
Copy
```
and(<expression1>, <expression2>, ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression1*\>, \<*expression2*\>, ... | Yes | Boolean | The expressions to check |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
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:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#createArray).
Copy
```
array('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string for creating an array |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*value*\>\] | Array | An array that contains the single specified input |
*Example*
This example creates an array from the "hello" string:
Copy
```
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
Copy
```
base64('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The input string |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*base64-string*\> | String | The base64-encoded version for the input string |
*Example*
This example converts the "hello" string to a base64-encoded string:
Copy
```
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
Copy
```
base64ToBinary('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The base64-encoded string to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-base64-string*\> | String | The binary version for the base64-encoded string |
*Example*
This example converts the "aGVsbG8=" base64-encoded string to a binary string:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
Copy
```
base64ToString('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The base64-encoded string to decode |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*decoded-base64-string*\> | String | The string version for a base64-encoded string |
*Example*
This example converts the "aGVsbG8=" base64-encoded string to just a string:
Copy
```
base64ToString('aGVsbG8=')
```
And returns this result: `"hello"`
### binary
Return the base64-encoded binary version of a string.
Copy
```
binary('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-input-value*\> | String | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#actions).
Copy
```
body('<actionName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action's `body` output that you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*action-body-output*\> | String | The `body` output from the specified action |
*Example*
This example gets the `body` output from the `Get user` X action:
Copy
```
body('Get_user')
```
And returns this result:
JSON
Copy
```
"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.
Copy
```
bool(<value>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Any | The 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.
Expand table
| Return value | Type | Description |
|---|---|---|
| `true` or `false` | Boolean | The Boolean version of the specified value. |
*Outputs*
These examples show the different supported types of input for `bool()`:
Expand table
| Input value | Type | Return value |
|---|---|---|
| `bool(1)` | Integer | `true` |
| `bool(0)` | Integer | `false` |
| `bool(-1)` | Integer | `true` |
| `bool('true')` | String | `true` |
| `bool('false')` | String | `false` |
## C
### chunk
Split a string or array into chunks of equal length.
Copy
```
chunk('<collection>', '<length>')
chunk([<collection>], '<length>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection to split |
| \<*length*\> | Yes | The length of each chunk | |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*collection*\> | Array | An array of chunks with the specified length |
*Example 1*
This example splits a string into chunks of length 10:
Copy
```
chunk('abcdefghijklmnopqrstuvwxyz', 10)
```
And returns this result: `['abcdefghij', 'klmnopqrst', 'uvwxyz']`
*Example 2*
This example splits an array into chunks of length 5.
Copy
```
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.
Copy
```
coalesce(<object_1>, <object_2>, ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object\_1*\>, \<*object\_2*\>, ... | Yes | Any, can mix types | One or more items to check for null |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*first-non-null-item*\> | Any | The 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:
Copy
```
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.
Copy
```
concat('<text1>', '<text2>', ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text1*\>, \<*text2*\>, ... | Yes | String | At least two strings to combine |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*text1text2...*\> | String | The 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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
*Example*
This example combines the strings "Hello" and "World":
Copy
```
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.
Copy
```
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*
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String, Array, or Dictionary | The collection to check |
| \<*value*\> | Yes | String, Array, or Dictionary, respectively | The item to find |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
contains('hello world', 'world')
```
*Example 2*
This example checks the string "hello world" for the substring "universe" and returns false:
Copy
```
contains('hello world', 'universe')
```
### convertFromUtc
Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
Copy
```
convertFromUtc('<timestamp>', '<destinationTimeZone>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*destinationTimeZone*\> | Yes | String | The name for the target time zone. For time zone names, review [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones). |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The timestamp converted to the target time zone without the timezone UTC offset. |
*Example 1*
This example converts a timestamp to the specified time zone:
Copy
```
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:
Copy
```
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.
Copy
```
convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*sourceTimeZone*\> | Yes | String | The name for the source time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*destinationTimeZone*\> | Yes | String | The name for the target time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The timestamp converted to the target time zone |
*Example 1*
This example converts the source time zone to the target time zone:
Copy
```
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:
Copy
```
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).
Copy
```
convertToUtc('<timestamp>', '<sourceTimeZone>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*sourceTimeZone*\> | Yes | String | The name for the source time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The timestamp converted to UTC |
*Example 1*
This example converts a timestamp to UTC:
Copy
```
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:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#array).
Copy
```
createArray('<object1>', '<object2>', ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object1*\>, \<*object2*\>, ... | Yes | Any, but not mixed | At least two items to create the array |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*object1*\>, \<*object2*\>, ...\] | Array | The array created from all the input items |
*Example*
This example creates an array from these inputs:
Copy
```
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.
Copy
```
dataUri('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*data-uri*\> | String | The data URI for the input string |
*Example*
This example creates a data URI for the "hello" string:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#decodeDataUri). Although both functions work the same way, `dataUriBinary()` is preferred.
Copy
```
dataUriToBinary('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-data-uri*\> | String | The binary version for the data URI |
*Example*
This example creates a binary version for this data URI:
Copy
```
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).
Copy
```
dataUriToString('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*string-for-data-uri*\> | String | The string version for the data URI |
*Example*
This example creates a string for this data URI:
Copy
```
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.
Copy
```
dateDifference('<startDate>', '<endDate>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*startDate*\> | Yes | String | A string that contains a timestamp |
| \<*endDate*\> | Yes | String | A string that contains a timestamp |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*timespan*\> | String | The 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:
Copy
```
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.
Copy
```
dayOfMonth('<timestamp>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*day-of-month*\> | Integer | The day of the month from the specified timestamp |
*Example*
This example returns the number for the day of the month from this timestamp:
Copy
```
dayOfMonth('2018-03-15T13:27:36Z')
```
And returns this result: `15`
### dayOfWeek
Return the day of the week from a timestamp.
Copy
```
dayOfWeek('<timestamp>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*day-of-week*\> | Integer | The 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:
Copy
```
dayOfWeek('2018-03-15T13:27:36Z')
```
And returns this result: `4`
### dayOfYear
Return the day of the year from a timestamp.
Copy
```
dayOfYear('<timestamp>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*day-of-year*\> | Integer | The day of the year from the specified timestamp |
*Example*
This example returns the number of the day of the year from this timestamp:
Copy
```
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#logical-comparison-functions) and [math functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#math-functions). To capture and preserve precision when you use the result from the **decimal()** function, wrap any decimal output with the [string function](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string). 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](https://learn.microsoft.com/en-us/dotnet/api/system.decimal?view=netframework-4.7.1&preserve-view=true).
Copy
```
decimal('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The decimal number in a string |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*decimal*\> | Decimal Number | The decimal number for the input string |
*Example 1*
This example creates a decimal that's used as a number:
Copy
```
decimal('1.2345678912312131') // Returns 1.234567891231213.
```
*Example 2*
This example creates a decimal and then converts the result to a string for precision preservation:
Copy
```
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:
Copy
```
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:
Copy
```
string(add(decimal('1.2345678912312131'), decimal('1.2345678912312131'))) // Returns "2.4691357824624262".
```
### decodeBase64 (deprecated)
This function is deprecated, so use [base64ToString()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64ToString) instead.
### decodeDataUri
Return the binary version for a data uniform resource identifier (URI). Consider using [dataUriToBinary()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
Copy
```
decodeDataUri('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI string to decode |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-data-uri*\> | String | The binary version for a data URI string |
*Example*
This example returns the binary version for this data URI:
Copy
```
decodeDataUri('data:text/plain;charset=utf-8;base64,aGVsbG8=')
```
And returns this result: `"hello"`
### decodeUriComponent
Return a string that replaces escape characters with decoded versions.
Copy
```
decodeUriComponent('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string with the escape characters to decode |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*decoded-uri*\> | String | The updated string with the decoded escape characters |
*Example*
This example replaces the escape characters in this string with decoded versions:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#mod).
Copy
```
div(<dividend>, <divisor>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*dividend*\> | Yes | Integer or Float | The number to divide by the *divisor* |
| \<*divisor*\> | Yes | Integer or Float | The number that divides the *dividend*, but can't be zero |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*quotient-result*\> | Integer or Float | The 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](https://learn.microsoft.com/en-us/azure/logic-apps/call-azure-functions-from-workflows) from your logic app. |
*Example 1*
Both examples return this value with Integer type: `2`
Copy
```
div(10,5)
div(11,5)
```
*Example 2*
Both examples return this value with Float type: `2.2`
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
Copy
```
encodeUriComponent('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert to URI-encoded format |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*encoded-uri*\> | String | The URI-encoded string with escape characters |
*Example*
This example creates a URI-encoded version for this string:
Copy
```
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.
Copy
```
empty('<collection>')
empty([<collection>])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String, Array, or Object | The collection to check |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return true when the collection is empty. Return false when not empty. |
*Example*
These examples check whether the specified collections are empty:
Copy
```
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.
Copy
```
endsWith('<text>', '<searchText>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to check |
| \<*searchText*\> | Yes | String | The ending substring to find |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
endsWith('hello world', 'world')
```
And returns this result: `true`
*Example 2*
This example checks whether the "hello world" string ends with the "universe" string:
Copy
```
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.
Copy
```
equals('<object1>', '<object2>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object1*\>, \<*object2*\> | Yes | Various | The values, expressions, or objects to compare |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return true when both are equivalent. Return false when not equivalent. |
*Example*
These examples check whether the specified inputs are equivalent.
Copy
```
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.
Copy
```
first('<collection>')
first([<collection>])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection where to find the first item |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*first-collection-item*\> | Any | The first item in the collection |
*Example*
These examples find the first item in these collections:
Copy
```
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.
Copy
```
float('<value>', '<locale>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The 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*\> | No | String | The 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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*float-value*\> | Float | The 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:
Copy
```
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:
Copy
```
float('10.000,333', 'de-DE')
```
And returns this result: `10000.333`
*Example 3*
Examples of unexpectedly valid inputs:
Copy
```
float('12,3,4,5678') //Returns 12345678
float('1234567,8+') //Returns 12345678
float('12345,6,78,-') //Returns -12345678
float('-12,345,678,') //Returns -12345678
float('12345678.-') //Returns -12345678
float('.12345678') //Returns 0.12345678
```
### formatDateTime
Return a timestamp in the specified format.
Copy
```
formatDateTime('<timestamp>', '<format>'?, '<locale>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. |
| \<*locale*\> | No | String | The locale to use. If unspecified, the value is `en-us`. If *locale* isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*reformatted-timestamp*\> | String | The updated timestamp in the specified format and locale, if specified. |
*Examples*
Copy
```
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.
Copy
```
formDataMultiValues('<actionName>', '<key>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The action whose output has the key value you want |
| \<*key*\> | Yes | String | The name for the key whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*array-with-key-values*\>\] | Array | An 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:
Copy
```
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.
Copy
```
formDataValue('<actionName>', '<key>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The action whose output has the key value you want |
| \<*key*\> | Yes | String | The name for the key whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*key-value*\> | String | The 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:
Copy
```
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.
text
Copy
```
formatNumber(<number>, <format>, <locale>?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number*\> | Yes | Integer or Double | The value that you want to format. |
| \<*format*\> | Yes | String | A composite format string that specifies the format that you want to use. For the supported numeric format strings, see [Standard numeric format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings), which are supported by `number.ToString(<format>, <locale>)`. |
| \<*locale*\> | No | String | The 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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*formatted-number*\> | String | The 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".
Copy
```
formatNumber(1234567890, '#,##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".
Copy
```
formatNumber(1234567890, '#,##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".
Copy
```
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".
Copy
```
formatNumber(17.35, 'C2', 'is-IS')
```
## G
### getFutureTime
Return the current timestamp plus the specified time units.
Copy
```
getFutureTime(<interval>, <timeUnit>, <format>?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*interval*\> | Yes | Integer | The number of time units to add |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | Either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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:
Copy
```
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:
Copy
```
getFutureTime(5, 'Day', 'D')
```
And returns this result: `"Tuesday, March 6, 2018"`
### getPastTime
Return the current timestamp minus the specified time units.
Copy
```
getPastTime(<interval>, <timeUnit>, <format>?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*interval*\> | Yes | Integer | The number of specified time units to subtract |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | Either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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:
Copy
```
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:
Copy
```
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.
Copy
```
greater(<value>, <compareTo>)
greater('<value>', '<compareTo>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether greater than the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison value |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
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.
Copy
```
greaterOrEquals(<value>, <compareTo>)
greaterOrEquals('<value>', '<compareTo>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether greater than or equal to the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison value |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
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":
Copy
```
guid()
```
Also, you can specify a different format for the GUID other than the default format, "D", which is 32 digits separated by hyphens.
Copy
```
guid('<format>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*format*\> | No | String | A single [format specifier](https://learn.microsoft.com/en-us/dotnet/api/system.guid.tostring#system_guid_tostring_system_string_) for the returned GUID. By default, the format is "D", but you can use "N", "D", "B", "P", or "X". |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*GUID-value*\> | String | A randomly generated GUID |
*Example*
This example generates the same GUID, but as 32 digits, separated by hyphens, and enclosed in parentheses:
Copy
```
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.
Copy
```
if(<expression>, <valueIfTrue>, <valueIfFalse>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression*\> | Yes | Boolean | The expression to check |
| \<*valueIfTrue*\> | Yes | Any | The value to return when the expression is true |
| \<*valueIfFalse*\> | Yes | Any | The value to return when the expression is false |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*specified-return-value*\> | Any | The 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"`:
Copy
```
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.
Copy
```
indexOf('<text>', '<searchText>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*index-value*\> | Integer | The 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:
Copy
```
indexOf('hello world', 'world')
```
And returns this result: `6`
### int
Convert the string version for an integer to an actual integer number.
Copy
```
int('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string version for the integer to convert. The minimum and maximum values are the same as the limits for the integer data type. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*integer-result*\> | Integer | The 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":
Copy
```
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.
Copy
```
isFloat('<string>', '<locale>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to examine |
| \<*locale*\> | No | String | The RFC 4646 locale code to use |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*boolean-result*\> | Boolean | A 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:
Copy
```
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:
Copy
```
isFloat('10.000,00', 'de-DE')
```
And returns this result: `true`
### isInt
Return a boolean that indicates whether a string is an integer.
Copy
```
isInt('<string>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*string*\> | Yes | String | The string to examine |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*boolean-result*\> | Boolean | A boolean that indicates whether the string is an integer |
*Example*
This example checks whether a string is an integer:
Copy
```
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.
Copy
```
item()
```
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*current-array-item*\> | Any | The 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:
Copy
```
item().body
```
### items
Return the current item from each cycle in a for-each loop. Use this function inside the for-each loop.
Copy
```
items('<loopName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*loopName*\> | Yes | String | The name for the for-each loop |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*item*\> | Any | The item from the current cycle in the specified for-each loop |
*Example*
This example gets the current item from the specified for-each loop:
Copy
```
items('myForEachLoopName')
```
### iterationIndexes
Return the index value for the current iteration inside an Until loop. You can use this function inside nested Until loops.
Copy
```
iterationIndexes('<loopName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*loopName*\> | Yes | String | The name for the Until loop |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*index*\> | Integer | The 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')`
JSON
Copy
```
{
"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.
Copy
```
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.
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String or XML | The string or XML to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*JSON-result*\> | JSON native type, object, or array | The 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:
Copy
```
json('[1, 2, 3]')
```
And returns this result: `[1, 2, 3]`
*Example 2*
This example converts this string into JSON:
Copy
```
json('{"fullName": "Sophia Owen"}')
```
And returns this result:
JSON
Copy
```
{
"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:
JSON
Copy
```
{
"?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:
JSON
Copy
```
{
"?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.
Copy
```
intersection([<collection1>], [<collection2>], ...)
intersection('<collection1>', '<collection2>', ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection1*\>, \<*collection2*\>, ... | Yes | Array or Object, but not both | The collections from where you want *only* the common items |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*common-items*\> | Array or Object, respectively | A collection that has only the common items across the specified collections |
*Example*
This example finds the common items across these arrays:
Copy
```
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*.
Copy
```
join([<collection>], '<delimiter>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The array that has the items to join |
| \<*delimiter*\> | Yes | String | The separator that appears between each character in the resulting string |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*char1*\>\<*delimiter*\>\<*char2*\>\<*delimiter*\>... | String | The 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:
Copy
```
join(createArray('a', 'b', 'c'), '.')
```
And returns this result: `"a.b.c"`
## L
### last
Return the last item from a collection.
Copy
```
last('<collection>')
last([<collection>])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection where to find the last item |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*last-collection-item*\> | String or Array, respectively | The last item in the collection |
*Example*
These examples find the last item in these collections:
Copy
```
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.
Copy
```
lastIndexOf('<text>', '<searchText>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*ending-index-value*\> | Integer | The 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`:
Copy
```
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.
Copy
```
lastIndexOf('hello world hello world', '')
```
### length
Return the number of items in a collection.
Copy
```
length('<collection>')
length([<collection>])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection with the items to count |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*length-or-count*\> | Integer | The number of items in the collection |
*Example*
These examples count the number of items in these collections:
Copy
```
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.
Copy
```
less(<value>, <compareTo>)
less('<value>', '<compareTo>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether less than the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison item |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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.
Copy
```
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.
Copy
```
lessOrEquals(<value>, <compareTo>)
lessOrEquals('<value>', '<compareTo>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether less than or equal to the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison item |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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.
Copy
```
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.
Copy
```
listCallbackUrl()
```
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*callback-URL*\> | String | The 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.
Copy
```
max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number1*\>, \<*number2*\>, ... | Yes | Integer, Float, or both | The set of numbers from which you want the highest value |
| \[\<*number1*\>, \<*number2*\>, ...\] | Yes | Array - Integer, Float, or both | The array of numbers from which you want the highest value |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*max-value*\> | Integer or Float | The 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:
Copy
```
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.
Copy
```
min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number1*\>, \<*number2*\>, ... | Yes | Integer, Float, or both | The set of numbers from which you want the lowest value |
| \[\<*number1*\>, \<*number2*\>, ...\] | Yes | Array - Integer, Float, or both | The array of numbers from which you want the lowest value |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*min-value*\> | Integer or Float | The 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:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#div).
Copy
```
mod(<dividend>, <divisor>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*dividend*\> | Yes | Integer or Float | The number to divide by the *divisor* |
| \<*divisor*\> | Yes | Integer or Float | The number that divides the *dividend*, but can't be zero |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*modulo-result*\> | Integer or Float | The remainder from dividing the first number by the second number |
*Example 1*
This example divides the first number by the second number:
Copy
```
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:
Copy
```
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.
Copy
```
mul(<multiplicand1>, <multiplicand2>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*multiplicand1*\> | Yes | Integer or Float | The number to multiply by *multiplicand2* |
| \<*multiplicand2*\> | Yes | Integer or Float | The number that multiples *multiplicand1* |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*product-result*\> | Integer or Float | The product from multiplying the first number by the second number |
*Example*
These examples multiple the first number by the second number:
Copy
```
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.
Copy
```
multipartBody('<actionName>', <index>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action that has output with multiple parts |
| \<*index*\> | Yes | Integer | The index value for the part that you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*body*\> | String | The 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.
Copy
```
not(<expression>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression*\> | Yes | Boolean | The expression to check |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return true when the expression is false. Return false when the expression is true. |
*Example 1*
These examples check whether the specified expressions are false:
Copy
```
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:
Copy
```
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 *n*th occurrence of a substring appears in a string.
Copy
```
nthIndexOf('<text>', '<searchText>', <occurrence>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that contains the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
| \<*occurrence*\> | Yes | Integer | A number that specifies the *n*th occurrence of the substring to find. If *occurrence* is negative, start searching from the end. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*index-value*\> | Integer | The starting position or index value for the *n*th occurrence of the specified substring. If the substring isn't found or fewer than *n* occurrences of the substring exist, return `-1`. |
*Examples*
Copy
```
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.
Copy
```
or(<expression1>, <expression2>, ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression1*\>, \<*expression2*\>, ... | Yes | Boolean | The expressions to check |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
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:
JSON
Copy
```
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.
Copy
```
outputs('<actionName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action's output that you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*output*\> | String | The output from the specified action |
*Example*
This example gets the output from the X action `Get user`:
Copy
```
outputs('Get_user')
```
And returns this result:
JSON
Copy
```
{
"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.
Copy
```
parameters('<parameterName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*parameterName*\> | Yes | String | The name for the parameter whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*parameter-value*\> | Any | The value for the specified parameter |
*Example*
Suppose that you have this JSON value:
JSON
Copy
```
{
"fullName": "Sophia Owen"
}
```
This example gets the value for the specified parameter:
Copy
```
parameters('fullName')
```
And returns this result: `"Sophia Owen"`
### parseDateTime
Return the timestamp from a string that contains a timestamp.
Copy
```
parseDateTime('<timestamp>', '<locale>'?, '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*locale*\> | No | String | The locale to use. If not specified, the default locale is `en-us`. If *locale* isn't a valid value, an error is generated. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*parsed-timestamp*\> | String | The parsed timestamp in ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK) format, which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. |
*Examples*
Copy
```
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.
Copy
```
rand(<minValue>, <maxValue>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*minValue*\> | Yes | Integer | The lowest integer in the range |
| \<*maxValue*\> | Yes | Integer | The integer that follows the highest integer in the range that the function can return |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*random-result*\> | Integer | The random integer returned from the specified range |
*Example*
This example gets a random integer from the specified range, excluding the maximum value:
Copy
```
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.
Copy
```
range(<startIndex>, <count>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*startIndex*\> | Yes | Integer | An integer value that starts the array as the first item |
| \<*count*\> | Yes | Integer | The 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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*range-result*\>\] | Array | The 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:
Copy
```
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.
Copy
```
removeProperty(<object>, '<property>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object from where you want to remove a property |
| \<*property*\> | Yes | String | The name for the property to remove |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The updated JSON object without the specified property |
To remove a child property from an existing property, use this syntax:
Copy
```
removeProperty(<object>['<parent-property>'], '<child-property>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to remove |
| \<*parent-property*\> | Yes | String | The name for parent property with the child property that you want to remove |
| \<*child-property*\> | Yes | String | The name for the child property to remove |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#json) function, and returns the updated object:
Copy
```
removeProperty(json('{ "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" }'), 'middleName')
```
Here's the current JSON object:
JSON
Copy
```
{
"firstName": "Sophia",
"middleName": "Anne",
"surName": "Owen"
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#json) function, and returns the updated object:
Copy
```
removeProperty(json('{ "customerName": { "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" } }')['customerName'], 'middleName')
```
Here's the current JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophia",
"middleName": "Anne",
"surName": "Owen"
}
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophia",
"surName": "Owen"
}
}
```
### replace
Replace a substring with the specified string, and return the result string. This function is case-sensitive.
Copy
```
replace('<text>', '<oldText>', '<newText>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to replace |
| \<*oldText*\> | Yes | String | The substring to replace |
| \<*newText*\> | Yes | String | The replacement string |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-text*\> | String | The 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":
Copy
```
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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-exception-handling#get-results-from-failures).
Copy
```
result('<scopedActionName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*scopedActionName*\> | Yes | String | The name of the scoped action where you want the inputs and outputs from the top-level actions inside that scope |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*array-object*\> | Array object | An 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:
JSON
Copy
```
{
"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.
JSON
Copy
```
[
{
"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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#sort), you can sort a collection in descending order.
Copy
```
reverse([<collection>])
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection to reverse |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The reversed collection |
*Example*
This example reverses an array of integers:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#addProperty) function.
Copy
```
setProperty(<object>, '<property>', <value>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to set |
| \<*property*\> | Yes | String | The name for the existing or new property to set |
| \<*value*\> | Yes | Any | The 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.
Copy
```
setProperty(<object>, '<parent-property>', setProperty(<object>['parentProperty'], '<child-property>', <value>))
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to set |
| \<*parent-property*\> | Yes | String | The name for parent property with the child property that you want to set |
| \<*child-property*\> | Yes | String | The name for the child property to set |
| \<*value*\> | Yes | Any | The value to set for the specified property |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#json) function. The function assigns the specified value to the property and returns the updated object:
Copy
```
setProperty(json('{ "firstName": "Sophia", "surName": "Owen" }'), 'surName', 'Hartnett')
```
Here's the current JSON object:
JSON
Copy
```
{
"firstName": "Sophia",
"surName": "Owen"
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#json) function. The function assigns the specified value to the property and returns the updated object:
Copy
```
setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }'), 'customerName', setProperty(json('{ "customerName": { "firstName": "Sophia", "surName": "Owen" } }')['customerName'], 'surName', 'Hartnett'))
```
Here's the current JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophie",
"surName": "Owen"
}
}
```
Here's the updated JSON object:
JSON
Copy
```
{
"customerName": {
"firstName": "Sophie",
"surName": "Hartnett"
}
}
```
### skip
Remove items from the front of a collection, and return *all the other* items.
Copy
```
skip([<collection>], <count>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection whose items you want to remove |
| \<*count*\> | Yes | Integer | A positive integer for the number of items to remove at the front |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The updated collection after removing the specified items |
*Example*
This example removes one item, the number 0, from the front of the specified array:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#substring).
Copy
```
slice('<text>', <startIndex>, <endIndex>?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that contains the substring to find |
| \<*startIndex*\> | Yes | Integer | The 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*\> | No | Integer | The 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*. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*slice-result*\> | String | A new string that contains the found substring |
*Examples*
Copy
```
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 primitive data type supported by the Workflow Definition Language, such as **int**, **float**, **string**, or **bool**.
Copy
```
sort([<collection>], <sortBy>?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection with the items to sort |
| \<*sortBy*\> | No | String | The key to use for sorting the collection objects |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The sorted collection |
*Example 1*
This example sorts an array of integers:
Copy
```
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:
Copy
```
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.
Copy
```
split('<text>', '<delimiter>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to separate into substrings based on the specified delimiter in the original string |
| \<*delimiter*\> | Yes | String | The character in the original string to use as the delimiter |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*substring1*\>,\<*substring2*\>,...\] | Array | An 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:
Copy
```
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:
Copy
```
split('a_b_c', ' ')
```
And returns this array as the result: `["a_b_c"]`
### startOfDay
Return the start of the day for a timestamp.
Copy
```
startOfDay('<timestamp>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The specified timestamp but starting at the zero-hour mark for the day |
*Example*
This example finds the start of the day for this timestamp:
Copy
```
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.
Copy
```
startOfHour('<timestamp>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The specified timestamp but starting at the zero-minute mark for the hour |
*Example*
This example finds the start of the hour for this timestamp:
Copy
```
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.
Copy
```
startOfMonth('<timestamp>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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:
Copy
```
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:
Copy
```
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.
Copy
```
startsWith('<text>', '<searchText>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to check |
| \<*searchText*\> | Yes | String | The starting string to find |
Expand table
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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:
Copy
```
startsWith('hello world', 'hello')
```
And returns this result: `true`
*Example 2*
This example checks whether the "hello world" string starts with the "greetings" substring:
Copy
```
startsWith('hello world', 'greetings')
```
And returns this result: `false`
### string
Return the string version for a value.
Copy
```
string(<value>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Any | The 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. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*string-value*\> | String | The 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:
Copy
```
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 (").
Copy
```
string( { "name": "Sophie Owen" } )
```
And returns this result: `"{ \\"name\\": \\"Sophie Owen\\" }"`
### sub
Return the result from subtracting the second number from the first number.
Copy
```
sub(<minuend>, <subtrahend>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*minuend*\> | Yes | Integer or Float | The number from which to subtract the *subtrahend* |
| \<*subtrahend*\> | Yes | Integer or Float | The number to subtract from the *minuend* |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*result*\> | Integer or Float | The result from subtracting the second number from the first number |
*Example*
This example subtracts the second number from the first number:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#slice).
Copy
```
substring('<text>', <startIndex>, <length>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string whose characters you want |
| \<*startIndex*\> | Yes | Integer | A positive number equal to or greater than 0 that you want to use as the starting position or index value |
| \<*length*\> | No | Integer | A 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.
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*substring-result*\> | String | A 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:
Copy
```
substring('hello world', 6, 5)
```
And returns this result: `"world"`
### subtractFromTime
Subtract a number of time units from a timestamp. See also [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#getPastTime).
Copy
```
subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*interval*\> | Yes | Integer | The number of specified time units to subtract |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The timestamp minus the specified number of time units |
*Example 1*
This example subtracts one day from this timestamp:
Copy
```
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:
Copy
```
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.
Copy
```
take('<collection>', <count>)
take([<collection>], <count>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection whose items you want |
| \<*count*\> | Yes | Integer | A positive integer for the number of items that you want from the front |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*subset*\> or \[\<*subset*\>\] | String or Array, respectively | A 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:
Copy
```
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)](https://learn.microsoft.com/en-us/dotnet/api/system.datetime.ticks).
Copy
```
ticks('<timestamp>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string for a timestamp |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*ticks-number*\> | Integer | The 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.
Copy
```
toLower('<text>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to return in lowercase format |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*lowercase-text*\> | String | The original string in lowercase format |
*Example*
This example converts this string to lowercase:
Copy
```
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.
Copy
```
toUpper('<text>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to return in uppercase format |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*uppercase-text*\> | String | The original string in uppercase format |
*Example*
This example converts this string to uppercase:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerOutputs) and [triggerBody()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerBody).
Copy
```
trigger()
```
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*trigger-output*\> | String | The output from a trigger at runtime |
### triggerBody
Return a trigger's `body` output at runtime. Shorthand for `trigger().outputs.body`. See [trigger()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#trigger).
Copy
```
triggerBody()
```
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*trigger-body-output*\> | String | The `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.
Copy
```
triggerFormDataMultiValues('<key>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*key*\> | Yes | String | The name for the key whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \[\<*array-with-key-values*\>\] | Array | An 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:
Copy
```
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.
Copy
```
triggerFormDataValue('<key>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*key*\> | Yes | String | The name for the key whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*key-value*\> | String | The 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:
Copy
```
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.
Copy
```
triggerMultipartBody(<index>)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*index*\> | Yes | Integer | The index value for the part that you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*body*\> | String | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#trigger).
Copy
```
triggerOutputs()
```
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*trigger-output*\> | String | The output from a trigger at runtime |
### trim
Remove leading and trailing whitespace from a string, and return the updated string.
Copy
```
trim('<text>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the leading and trailing whitespace to remove |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updatedText*\> | String | An 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 ":
Copy
```
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.
Copy
```
union('<collection1>', '<collection2>', ...)
union([<collection1>], [<collection2>], ...)
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection1*\>, \<*collection2*\>, ... | Yes | Array or Object, but not both | The collections from where you want *all* the items |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*updatedCollection*\> | Array or Object, respectively | A collection with all the items from the specified collections - no duplicates |
*Example*
This example gets *all* the items from these collections:
Copy
```
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#encodeUriComponent). Although both functions work the same way, `uriComponent()` is preferred.
Copy
```
uriComponent('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert to URI-encoded format |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*encoded-uri*\> | String | The URI-encoded string with escape characters |
*Example*
This example creates a URI-encoded version for this string:
Copy
```
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.
Copy
```
uriComponentToBinary('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The URI-encoded string to convert |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-encoded-uri*\> | String | The 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:
Copy
```
uriComponentToBinary('https%3A%2F%2Fcontoso.com')
```
And returns this result: `"aHR0cHM6Ly9jb250b3NvLmNvbQ=="`
### uriComponentToString
Return the string version for a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.
Copy
```
uriComponentToString('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The URI-encoded string to decode |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*decoded-uri*\> | String | The decoded version for the URI-encoded string |
*Example*
This example creates the decoded string version for this URI-encoded string:
Copy
```
uriComponentToString('https%3A%2F%2Fcontoso.com')
```
And returns this result: `"https://contoso.com"`
### uriHost
Return the `host` value for a uniform resource identifier (URI).
Copy
```
uriHost('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `host` value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*host-value*\> | String | The `host` value for the specified URI |
*Example*
This example finds the `host` value for this URI:
Copy
```
uriHost('https://www.localhost.com:8080')
```
And returns this result: `"www.localhost.com"`
### uriPath
Return the `path` value for a uniform resource identifier (URI).
Copy
```
uriPath('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `path` value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*path-value*\> | String | The `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:
Copy
```
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).
Copy
```
uriPathAndQuery('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `path` and `query` values you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*path-query-value*\> | String | The `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:
Copy
```
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).
Copy
```
uriPort('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `port` value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*port-value*\> | Integer | The `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:
Copy
```
uriPort('https://www.localhost:8080')
```
And returns this result: `8080`
### uriQuery
Return the `query` value for a uniform resource identifier (URI).
Copy
```
uriQuery('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `query` value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*query-value*\> | String | The `query` value for the specified URI |
*Example*
This example returns the `query` value for this URI:
Copy
```
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).
Copy
```
uriScheme('<uri>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `scheme` value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*scheme-value*\> | String | The `scheme` value for the specified URI |
*Example*
This example returns the `scheme` value for this URI:
Copy
```
uriScheme('https://www.contoso.com/catalog/shownew.htm?date=today')
```
And returns this result: `"http"`
### utcNow
Return the current timestamp.
Copy
```
utcNow('<format>')
```
Optionally, you can specify a different format with the \<*format*\> parameter.
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*current-timestamp*\> | String | The current date and time |
*Examples*
Copy
```
utcNow() // Returns 2025-09-25T05:18:31.3384797Z
utcNow('u') // Returns 2025-09-25 05:18:31Z
utcNow('U') // Returns Thursday, September 25, 2025 5:18:31 AM
utcNow('d') // Returns 9/25/2025
utcNow('D') // Returns Thursday, September 25, 2025
utcNow('t') // Returns 5:18 AM
utcNow('T') // Returns 5:18:31 AM
utcNow('y') // Returns September 2025
utcNow('yyyy') // Returns 2025
utcNow('ddd, d MMM yyyy') // Returns Thu, 25 Sep 2025
```
## V
### variables
Return the value for a specified variable.
Copy
```
variables('<variableName>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*variableName*\> | Yes | String | The name for the variable whose value you want |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*variable-value*\> | Any | The 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:
Copy
```
variables('numItems')
```
And returns this result: `20`
## W
### workflow
Return all the details about the workflow itself during run time.
Copy
```
workflow().<property>
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources) 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](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources). **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.
Copy
```
xml('<value>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The 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 ("). |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*xml-version*\> | Object | The 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:
XML
Copy
```
<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:
XML
Copy
```
<name>Sophia Owen</name>
```
*Example 3*
Suppose you have this JSON object:
JSON
Copy
```
{
"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:
XML
Copy
```
<person>
<name>Sophia Owen</name>
<city>Seattle</city>
<person>
```
*Example 4*
The `xml()` function expects either an object or a string containing valid XML. The function doesn't accept a raw array as input.
If you have a JSON array, like the following example, you have four options.
JSON
Copy
```
[
{ "ID": 1, "Name": "James" },
{ "ID": 2, "Name": "John" },
{ "ID": 3, "Name": "Sam" }
]
```
Option 1: Convert the JSON string to a JSON object before you pass the result to the `xml()` function, for example:
Copy
```
xml(
json('{"root":{"array":[
{ "ID": 1, "Name": "James" },
{ "ID": 2, "Name": "John" },
{ "ID": 3, "Name": "Sam" }
]}}')
)
```
Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**, and store the returned JSON object in another **Compose** action named **Compose2**.
Copy
```
{
"root": { "array": @{outputs('Compose1')} }
}
```
You can then use the `xml()` and `outputs()` functions to create XML from the JSON object output from **Compose2**, for example:
Copy
```
xml(outputs('Compose2'))
```
Option 3: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()`, `concat()`, `json()`, and `xml()` functions to create XML from the JSON object output, for example:
Copy
```
xml(
json(
concat(
'{"root":{"array":',
outputs('Compose1'),
'}}'
)
)
)
```
Option 4: Similar to option 3, but uses `addProperty()` instead of the `concat()` function to create the JSON object before passing it to the `xml()` function, for example:
Copy
```
xml(
addProperty(
json('{}'),
'root',
addProperty(
json('{}'),
'array',
outputs('Compose1')
)
)
)
```
All the examples from options 1 to 4 return the following XML result:
XML
Copy
```
<root>
<array>
<ID>1</ID>
<Name>James</Name>
</array>
<array>
<ID>2</ID>
<Name>John</Name>
</array>
<array>
<ID>3</ID>
<Name>Sam</Name>
</array>
</root>
```
### 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](https://learn.microsoft.com/en-us/dotnet/api/system.xml.xpath). XPath expressions are compatible with the underlying .NET library and support only the expression that the underlying .NET library supports.
Copy
```
xpath('<xml>', '<xpath>')
```
Expand table
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*xml*\> | Yes | Any | The XML string to search for nodes or values that match an XPath expression value |
| \<*xpath*\> | Yes | Any | The XPath expression used to find matching XML nodes or values |
Expand table
| Return value | Type | Description |
|---|---|---|
| \<*xml-node*\> | XML | An XML node when only a single node matches the specified XPath expression |
| \<*value*\> | Any | The value from an XML node when only a single value matches the specified XPath expression |
| \[\<*xml-node1*\>, \<*xml-node2*\>, ...\] -or- \[\<*value1*\>, \<*value2*\>, ...\] | Array | An array with XML nodes or values that match the specified XPath expression |
*Example 1*
Suppose that you have this `'items'` XML string:
XML
Copy
```
<?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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#parameters) function to get the XML string from `'items'` and convert the string to XML format by using the [xml()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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
Copy
```
<?xml version="1.0"?>
<produce>
<item>
<name expired='true'>Gala</name>
<type>apple</type>
<count>20</count>
</item>
<item>
<name expired='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
Copy
```
<?xml version="1.0"?>
<produce>
<item>
<name expired='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
Copy
```
<?xml version="1.0"?>
<produce>
<item>
<name expired='true' price='12'>Gala</name>
<type>apple</type>
<count>20</count>
</item>
<item>
<name expired='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
Copy
```
<?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
Copy
```
<?xml version="1.0"?><file xmlns="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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language)
***
## Feedback
Was this page helpful?
Yes
No
No
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Ask Learn
Ask Learn
Suggest a fix?
***
## Additional resources
***
- Last updated on
10/06/2025
## In this article
1. [Functions in expressions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#functions-in-expressions)
2. [Considerations for using functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#considerations-for-using-functions)
3. [String functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string-functions)
4. [Collection functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#collection-functions)
5. [Logical comparison functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#logical-comparison-functions)
6. [Conversion functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#conversion-functions)
7. [Implicit data type conversions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#implicit-data-type-conversions)
8. [Math functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#math-functions)
9. [Date and time functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#date-and-time-functions)
10. [Workflow functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#workflow-functions)
11. [URI parsing functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#uri-parsing-functions)
12. [Manipulation functions: JSON & XML](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#manipulation-functions-json--xml)
13. [\---------------------------------](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#---------------------------------)
14. [All functions - alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#all-functions---alphabetical-list)
15. [A](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#a)
16. [B](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#b)
17. [C](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#c)
18. [D](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#d)
19. [E](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#e)
20. [F](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#f)
21. [G](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#g)
22. [I](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#i)
23. [J](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#j)
24. [L](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#l)
25. [M](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#m)
26. [N](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#n)
27. [O](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#o)
28. [P](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#p)
29. [R](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#r)
30. [S](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#s)
31. [T](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#t)
32. [U](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#u)
33. [V](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#v)
34. [W](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#w)
35. [X](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#x)
36. [Next steps](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#next-steps)
Show 27 more
Was this page helpful?
Yes
No
No
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Ask Learn
Ask Learn
Suggest a fix?
## Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
[Sign in](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference)
[English (United States)](https://learn.microsoft.com/en-us/locale?target=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fexpression-functions-reference)
[Your Privacy Choices](https://aka.ms/yourcaliforniaprivacychoices)
Theme
- Light
- Dark
- High contrast
- [AI Disclaimer](https://learn.microsoft.com/en-us/principles-for-ai-generated-content)
- [Previous Versions](https://learn.microsoft.com/en-us/previous-versions/)
- [Blog](https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog)
- [Contribute](https://learn.microsoft.com/en-us/contribute)
- [Privacy](https://go.microsoft.com/fwlink/?LinkId=521839)
- [Consumer Health Privacy](https://go.microsoft.com/fwlink/?linkid=2259814)
- [Terms of Use](https://learn.microsoft.com/en-us/legal/termsofuse)
- [Trademarks](https://www.microsoft.com/legal/intellectualproperty/Trademarks/)
- © Microsoft 2026 |
| Readable Markdown | Reference guide to functions in expressions for workflows in Azure Logic Apps and Power Automate
Applies to: **Azure Logic Apps (Consumption + Standard)**
For workflow definitions in [Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview) and [Power Automate](https://learn.microsoft.com/en-us/power-automate/getting-started), some [expressions](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language).
Note
This reference guide applies to both Azure Logic Apps and Power Automate, but exists in the Azure Logic Apps documentation. Although guide refers specifically to logic app workflows, these functions work for both flows in Power Automate and workflows in Azure Logic Apps. For more information about functions and expressions in Power Automate, see [Use expressions in conditions](https://learn.microsoft.com/en-us/power-automate/use-expressions-in-conditions).
For example, you can calculate values by using math functions, such as the [add()](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#add) function, when you want the sum from integers or floats. Here are other example tasks that you can perform with functions:
| Task | Function syntax | Result |
|---|---|---|
| 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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#ordered-by-purpose), review the following tables. Or, for detailed information about each function, see the [alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#alphabetical-list).
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#parameters) function in an expression:
```
"accountName": "@parameters('customerName')"
```
Here are some other general ways that you can use functions in expressions:
| Task | Function 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.
- 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#alphabetical-list).
To work with strings, you can use these string functions and also some [collection functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#collection-functions). String functions work only on strings.
| String function | Task |
|---|---|
| [chunk](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#chunk) | Split a string or collection into chunks of equal length. |
| [concat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#concat) | Combine two or more strings, and return the combined string. |
| [endsWith](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#endswith) | Check whether a string ends with the specified substring. |
| [formatNumber](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatNumber) | Return a number as a string based on the specified format |
| [guid](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#guid) | Generate a globally unique identifier (GUID) as a string. |
| [indexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#indexof) | Return the starting position for a substring. |
| [isFloat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isFloat) | Return a boolean that indicates whether a string is a floating-point number. |
| [isInt](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isInt) | Return a boolean that indicates whether a string is an integer. |
| [lastIndexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#lastindexof) | Return the starting position for the last occurrence of a substring. |
| [length](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#length) | Return the number of items in a string or array. |
| [nthIndexOf](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#nthIndexOf) | Return the starting position or index value where the *n*th occurrence of a substring appears in a string. |
| [replace](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#replace) | Replace a substring with the specified string, and return the updated string. |
| [slice](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#slice) | Return a substring by specifying the starting and ending position or value. See also [substring](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#substring). |
| [split](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#split) | Return an array that contains substrings, separated by commas, from a larger string based on a specified delimiter character in the original string. |
| [startsWith](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startswith) | Check whether a string starts with a specific substring. |
| [substring](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#substring) | Return characters from a string, starting from the specified position. See also [slice](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#slice). |
| [toLower](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#toLower) | Return a string in lowercase format. |
| [toUpper](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#toUpper) | Return a string in uppercase format. |
| [trim](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trim) | Remove leading and trailing whitespace from a string, and return the updated string. |
To work with collections, generally arrays, strings, and sometimes, dictionaries, you can use these collection functions.
| Collection function | Task |
|---|---|
| [chunk](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#chunk) | Split a string or collection into chunks of equal length. |
| [contains](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#contains) | Check whether a collection has a specific item. |
| [empty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#empty) | Check whether a collection is empty. |
| [first](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#first) | Return the first item from a collection. |
| [intersection](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#intersection) | Return a collection that has *only* the common items across the specified collections. |
| [item](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#item) | If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration. |
| [join](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#join) | Return a string that has *all* the items from an array, separated by the specified character. |
| [last](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#last) | Return the last item from a collection. |
| [length](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#length) | Return the number of items in a string or array. |
| [reverse](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#reverse) | Reverse the order of items in an array. |
| [skip](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#skip) | Remove items from the front of a collection, and return *all the other* items. |
| [sort](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#sort) | Sort items in a collection. |
| [take](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#take) | Return items from the front of a collection. |
| [union](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#union) | Return a collection that has *all* the items from the specified collections. |
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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string).
| Logical comparison function | Task |
|---|---|
| [and](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#and) | Check whether all expressions are true. |
| [equals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#equals) | Check whether both values are equivalent. |
| [greater](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#greater) | Check whether the first value is greater than the second value. |
| [greaterOrEquals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#greaterOrEquals) | Check whether the first value is greater than or equal to the second value. |
| [if](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#if) | Check whether an expression is true or false. Based on the result, return a specified value. |
| [isFloat](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isFloat) | Return a boolean that indicates whether a string is a floating-point number. |
| [isInt](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#isInt) | Return a boolean that indicates whether a string is an integer. |
| [less](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#less) | Check whether the first value is less than the second value. |
| [lessOrEquals](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#lessOrEquals) | Check whether the first value is less than or equal to the second value. |
| [not](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#not) | Check whether an expression is false. |
| [or](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#or) | Check whether at least one expression is true. |
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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type). For the full reference about each function, see the [alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#implicit-data-conversions).
| Conversion function | Task |
|---|---|
| [array](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#array) | Return an array from a single specified input. For multiple inputs, see [createArray](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#createArray). |
| [base64](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64) | Return the base64-encoded version for a string. |
| [base64ToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64ToBinary) | Return the binary version for a base64-encoded string. |
| [base64ToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#base64ToString) | Return the string version for a base64-encoded string. |
| [binary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#binary) | Return the binary version for an input value. |
| [bool](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#bool) | Return the Boolean version for an input value. |
| [createArray](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#createArray) | Return an array from multiple inputs. |
| [dataUri](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUri) | Return the data URI for an input value. |
| [dataUriToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUriToBinary) | Return the binary version for a data URI. |
| [dataUriToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dataUriToString) | Return the string version for a data URI. |
| [decimal](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decimal) | Return the decimal number for a decimal string. |
| [decodeBase64](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeBase64) | Return the string version for a base64-encoded string. |
| [decodeDataUri](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeDataUri) | Return the binary version for a data URI. |
| [decodeUriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#decodeUriComponent) | Return a string that replaces escape characters with decoded versions. |
| [encodeUriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#encodeUriComponent) | Return a string that replaces URL-unsafe characters with escape characters. |
| [float](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#float) | Return a floating point number for an input value. |
| [int](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#int) | Return the integer version for a string. |
| [json](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#json) | Return the JavaScript Object Notation (JSON) type value or object for a string or XML. |
| [string](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#string) | Return the string version for an input value. |
| [uriComponent](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponent) | Return the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters. |
| [uriComponentToBinary](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponentToBinary) | Return the binary version for a URI-encoded string. |
| [uriComponentToString](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriComponentToString) | Return the string version for a URI-encoded string. |
| [xml](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xml) | Return the XML version for a string. |
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']}`
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.
To work with integers and floats, you can use these math functions. For the full reference about each function, see the [alphabetical list](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
| Math function | Task |
|---|---|
| [add](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#add) | Return the result from adding two numbers. |
| [div](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#div) | Return the result from dividing two numbers. |
| [max](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#max) | Return the highest value from a set of numbers or an array. |
| [min](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#min) | Return the lowest value from a set of numbers or an array. |
| [mod](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#mod) | Return the remainder from dividing two numbers. |
| [mul](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#mul) | Return the product from multiplying two numbers. |
| [rand](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#rand) | Return a random integer from a specified range. |
| [range](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#range) | Return an integer array that starts from a specified integer. |
| [sub](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#sub) | Return the result from subtracting the second number from the first number. |
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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
| Date or time function | Task |
|---|---|
| [addDays](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addDays) | Add days to a timestamp. |
| [addHours](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addHours) | Add hours to a timestamp. |
| [addMinutes](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addMinutes) | Add minutes to a timestamp. |
| [addSeconds](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addSeconds) | Add seconds to a timestamp. |
| [addToTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addToTime) | Add specified time units to a timestamp. See also [getFutureTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getFutureTime). |
| [convertFromUtc](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertFromUtc) | Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone. |
| [convertTimeZone](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertTimeZone) | Convert a timestamp from the source time zone to the target time zone. |
| [convertToUtc](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertToUtc) | Convert a timestamp from the source time zone to Universal Time Coordinated (UTC). |
| [dateDifference](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dateDifference) | Return the difference between two dates as a timespan. |
| [dayOfMonth](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfMonth) | Return the day of the month component from a timestamp. |
| [dayOfWeek](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfWeek) | Return the day of the week component from a timestamp. |
| [dayOfYear](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfYear) | Return the day of the year component from a timestamp. |
| [formatDateTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatDateTime) | Return the date from a timestamp. |
| [getFutureTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getFutureTime) | Return the current timestamp plus the specified time units. See also [addToTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addToTime). |
| [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getPastTime) | Return the current timestamp minus the specified time units. See also [subtractFromTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#subtractFromTime). |
| [parseDateTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parseDateTime) | Return the timestamp from a string that contains a timestamp. |
| [startOfDay](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfDay) | Return the start of the day for a timestamp. |
| [startOfHour](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfHour) | Return the start of the hour for a timestamp. |
| [startOfMonth](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#startOfMonth) | Return the start of the month for a timestamp. |
| [subtractFromTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#subtractFromTime) | Subtract a number of time units from a timestamp. See also [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#getPastTime). |
| [ticks](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#ticks) | Return the `ticks` property value for a specified timestamp. |
| [utcNow](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#utcNow) | Return the current timestamp as a string. |
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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
| Workflow function | Task |
|---|---|
| [action](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#action) | Return the current action's output at runtime, or values from other JSON name-and-value pairs. See also [actions](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#actions). |
| [actions](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#actions) | Return an action's output at runtime, or values from other JSON name-and-value pairs. See also [action](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#action). |
| [body](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#body) | Return an action's `body` output at runtime. |
| [formDataMultiValues](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formDataMultiValues) | Create an array with the values that match a key name in *form-data* or *form-encoded* action outputs. |
| [formDataValue](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formDataValue) | Return a single value that matches a key name in an action's *form-data* or *form-encoded output*. |
| [item](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#item) | If this function appears inside a repeating action over an array, return the current item in the array during the action's current iteration. |
| [items](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#items) | If this function appears inside a Foreach or Until loop, return the current item from the specified loop. |
| [iterationIndexes](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#iterationIndexes) | If this function appears inside an Until loop, return the index value for the current iteration. You can use this function inside nested Until loops. |
| [listCallbackUrl](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#listCallbackUrl) | Return the "callback URL" that calls a trigger or action. |
| [multipartBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#multipartBody) | Return the body for a specific part in an action's output that has multiple parts. |
| [outputs](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#outputs) | Return an action's output at runtime. |
| [parameters](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parameters) | Return the value for a parameter that is described in your workflow definition. |
| [result](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#result) | Return the inputs and outputs from the top-level actions inside the specified scoped action, such as `For_each`, `Until`, and `Scope`. |
| [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger) | Return a trigger's output at runtime, or from other JSON name-and-value pairs. See also [triggerOutputs](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerOutputs) and [triggerBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerBody). |
| [triggerBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerBody) | Return a trigger's `body` output at runtime. See [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger). |
| [triggerFormDataValue](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerFormDataValue) | Return a single value matching a key name in *form-data* or *form-encoded* trigger outputs. |
| [triggerMultipartBody](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerMultipartBody) | Return the body for a specific part in a trigger's multipart output. |
| [triggerFormDataMultiValues](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerFormDataMultiValues) | Create an array whose values match a key name in *form-data* or *form-encoded* trigger outputs. |
| [triggerOutputs](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#triggerOutputs) | Return a trigger's output at runtime, or values from other JSON name-and-value pairs. See [trigger](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#trigger). |
| [variables](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#variables) | Return the value for a specified variable. |
| [workflow](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#workflow) | Return all the details about the workflow itself during run time. |
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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
| URI parsing function | Task |
|---|---|
| [uriHost](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriHost) | Return the `host` value for a uniform resource identifier (URI). |
| [uriPath](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPath) | Return the `path` value for a uniform resource identifier (URI). |
| [uriPathAndQuery](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPathAndQuery) | Return the `path` and `query` values for a uniform resource identifier (URI). |
| [uriPort](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriPort) | Return the `port` value for a uniform resource identifier (URI). |
| [uriQuery](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriQuery) | Return the `query` value for a uniform resource identifier (URI). |
| [uriScheme](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#uriScheme) | Return the `scheme` value for a uniform resource identifier (URI). |
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](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#alphabetical-list).
| Manipulation function | Task |
|---|---|
| [addProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addProperty) | Add a property and its value, or name-value pair, to a JSON object, and return the updated object. |
| [coalesce](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#coalesce) | Return the first non-null value from one or more parameters. |
| [removeProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#removeProperty) | Remove a property from a JSON object and return the updated object. |
| [setProperty](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#setProperty) | Set the value for a JSON object's property and return the updated object. |
| [xpath](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xpath) | Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values. |
This section lists all the available functions in alphabetical order.
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()](https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#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>
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/rest/api/logic/workflowrunactions/get). |
| Return value | Type | Description |
|---|---|---|
| \<*action-output*\> | Object | The JSON object output from the current action or property |
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#body). For the current action, see [action()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language).
```
actions('<actionName>')
actions('<actionName>').outputs.body.<property>
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action object whose output you want |
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/rest/api/logic/workflowrunactions/get). |
| Return value | Type | Description |
|---|---|---|
| \<*action-output*\> | Object | The JSON object 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"`
Return the result from adding two numbers.
```
add(<summand_1>, <summand_2>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*summand\_1*\>, \<*summand\_2*\> | Yes | Integer, Float, or mixed | The numbers to add |
| Return value | Type | Description |
|---|---|---|
| \<*result-sum*\> | Integer or Float | The result from adding the specified numbers |
*Example*
This example adds the specified numbers:
```
add(1, 1.5)
```
And returns this result: `2.5`
Add days to a timestamp.
```
addDays('<timestamp>', <days>, '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*days*\> | Yes | Integer | The positive or negative number of days to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Add hours to a timestamp.
```
addHours('<timestamp>', <hours>, '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*hours*\> | Yes | Integer | The positive or negative number of hours to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Add minutes to a timestamp.
```
addMinutes('<timestamp>', <minutes>, '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*minutes*\> | Yes | Integer | The positive or negative number of minutes to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
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>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object where you want to add a property |
| \<*property*\> | Yes | String | The name for the property to add |
| \<*value*\> | Yes | Any | The value for the property |
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object where you want to add a property |
| \<*parent-property*\> | Yes | String | The name for parent property where you want to add the child property |
| \<*child-property*\> | Yes | String | The name for the child property to add |
| \<*value*\> | Yes | Any | The value to set for the specified property |
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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"
}
}
```
Add seconds to a timestamp.
```
addSeconds('<timestamp>', <seconds>, '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*seconds*\> | Yes | Integer | The positive or negative number of seconds to add |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Add the specified time units to a timestamp. See also [getFutureTime()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#getFutureTime).
```
addToTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*interval*\> | Yes | Integer | The number of specified time units to add |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
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>, ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression1*\>, \<*expression2*\>, ... | Yes | Boolean | The expressions to check |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`.
Return an array from a single specified input. For multiple inputs, see [createArray()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#createArray).
```
array('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string for creating an array |
| Return value | Type | Description |
|---|---|---|
| \[\<*value*\>\] | Array | An array that contains the single specified input |
*Example*
This example creates an array from the "hello" string:
```
array('hello')
```
And returns this result: `["hello"]`
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
```
base64('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The input string |
| Return value | Type | Description |
|---|---|---|
| \<*base64-string*\> | String | The 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="`
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
```
base64ToBinary('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The base64-encoded string to convert |
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-base64-string*\> | String | The 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.
Return the string version for a base64-encoded string, effectively decoding the base64 string. Use this function rather than [decodeBase64()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
```
base64ToString('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The base64-encoded string to decode |
| Return value | Type | Description |
|---|---|---|
| \<*decoded-base64-string*\> | String | The 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"`
Return the base64-encoded binary version of a string.
```
binary('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert |
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-input-value*\> | String | The 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.
Return an action's `body` output at runtime. Shorthand for `actions('<actionName>').outputs.body`. See [actions()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#actions).
```
body('<actionName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action's `body` output that you want |
| Return value | Type | Description |
|---|---|---|
| \<*action-body-output*\> | String | The `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"
}
```
Return the Boolean version of a value.
```
bool(<value>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Any | The 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 value | Type | Description |
|---|---|---|
| `true` or `false` | Boolean | The Boolean version of the specified value. |
*Outputs*
These examples show the different supported types of input for `bool()`:
| Input value | Type | Return value |
|---|---|---|
| `bool(1)` | Integer | `true` |
| `bool(0)` | Integer | `false` |
| `bool(-1)` | Integer | `true` |
| `bool('true')` | String | `true` |
| `bool('false')` | String | `false` |
Split a string or array into chunks of equal length.
```
chunk('<collection>', '<length>')
chunk([<collection>], '<length>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection to split |
| \<*length*\> | Yes | The length of each chunk | |
| Return value | Type | Description |
|---|---|---|
| \<*collection*\> | Array | An 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] ]`
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>, ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object\_1*\>, \<*object\_2*\>, ... | Yes | Any, can mix types | One or more items to check for null |
| Return value | Type | Description |
|---|---|---|
| \<*first-non-null-item*\> | Any | The 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`
Combine two or more strings, and return the combined string.
```
concat('<text1>', '<text2>', ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text1*\>, \<*text2*\>, ... | Yes | String | At least two strings to combine |
| Return value | Type | Description |
|---|---|---|
| \<*text1text2...*\> | String | The 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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
*Example*
This example combines the strings "Hello" and "World":
```
concat('Hello', 'World')
```
And returns this result: `"HelloWorld"`
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*
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String, Array, or Dictionary | The collection to check |
| \<*value*\> | Yes | String, Array, or Dictionary, respectively | The item to find |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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')
```
Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
```
convertFromUtc('<timestamp>', '<destinationTimeZone>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*destinationTimeZone*\> | Yes | String | The name for the target time zone. For time zone names, review [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones). |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The 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"`
Convert a timestamp from the source time zone to the target time zone.
```
convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*sourceTimeZone*\> | Yes | String | The name for the source time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*destinationTimeZone*\> | Yes | String | The name for the target time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The 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"`
Convert a timestamp from the source time zone to Universal Time Coordinated (UTC).
```
convertToUtc('<timestamp>', '<sourceTimeZone>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*sourceTimeZone*\> | Yes | String | The name for the source time zone. For time zone names, see [Microsoft Windows Default Time Zones](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones), but you might have to remove any punctuation from the time zone name. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*converted-timestamp*\> | String | The 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"`
Return an array from multiple inputs. For single input arrays, see [array()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#array).
```
createArray('<object1>', '<object2>', ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object1*\>, \<*object2*\>, ... | Yes | Any, but not mixed | At least two items to create the array |
| Return value | Type | Description |
|---|---|---|
| \[\<*object1*\>, \<*object2*\>, ...\] | Array | The 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"]`
Return a data uniform resource identifier (URI) for a string.
```
dataUri('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert |
| Return value | Type | Description |
|---|---|---|
| \<*data-uri*\> | String | The 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="`
Return the binary version for a data uniform resource identifier (URI). Use this function rather than [decodeDataUri()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#decodeDataUri). Although both functions work the same way, `dataUriBinary()` is preferred.
```
dataUriToBinary('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI to convert |
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-data-uri*\> | String | The 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"`
Return the string version for a data uniform resource identifier (URI).
```
dataUriToString('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI to convert |
| Return value | Type | Description |
|---|---|---|
| \<*string-for-data-uri*\> | String | The 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"`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*startDate*\> | Yes | String | A string that contains a timestamp |
| \<*endDate*\> | Yes | String | A string that contains a timestamp |
| Return value | Type | Description |
|---|---|---|
| \<*timespan*\> | String | The 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"`
Return the day of the month from a timestamp.
```
dayOfMonth('<timestamp>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| Return value | Type | Description |
|---|---|---|
| \<*day-of-month*\> | Integer | The 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`
Return the day of the week from a timestamp.
```
dayOfWeek('<timestamp>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| Return value | Type | Description |
|---|---|---|
| \<*day-of-week*\> | Integer | The 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`
Return the day of the year from a timestamp.
```
dayOfYear('<timestamp>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| Return value | Type | Description |
|---|---|---|
| \<*day-of-year*\> | Integer | The 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`
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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#logical-comparison-functions) and [math functions](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#math-functions). To capture and preserve precision when you use the result from the **decimal()** function, wrap any decimal output with the [string function](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#string). 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](https://learn.microsoft.com/en-us/dotnet/api/system.decimal?view=netframework-4.7.1&preserve-view=true).
```
decimal('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The decimal number in a string |
| Return value | Type | Description |
|---|---|---|
| \<*decimal*\> | Decimal Number | The 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".
```
This function is deprecated, so use [base64ToString()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64ToString) instead.
Return the binary version for a data uniform resource identifier (URI). Consider using [dataUriToBinary()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
```
decodeDataUri('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The data URI string to decode |
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-data-uri*\> | String | The 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: `"hello"`
Return a string that replaces escape characters with decoded versions.
```
decodeUriComponent('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string with the escape characters to decode |
| Return value | Type | Description |
|---|---|---|
| \<*decoded-uri*\> | String | The 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"`
Return the result from dividing two numbers. To get the remainder result, see [mod()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#mod).
```
div(<dividend>, <divisor>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*dividend*\> | Yes | Integer or Float | The number to divide by the *divisor* |
| \<*divisor*\> | Yes | Integer or Float | The number that divides the *dividend*, but can't be zero |
| Return value | Type | Description |
|---|---|---|
| \<*quotient-result*\> | Integer or Float | The 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](https://learn.microsoft.com/en-us/azure/logic-apps/call-azure-functions-from-workflows) 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)
```
Return a uniform resource identifier (URI) encoded version for a string by replacing URL-unsafe characters with escape characters. Consider using [uriComponent()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#base64-encoding-decoding).
```
encodeUriComponent('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert to URI-encoded format |
| Return value | Type | Description |
|---|---|---|
| \<*encoded-uri*\> | String | The 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"`
Check whether a collection is empty. Return true when the collection is empty, or return false when not empty.
```
empty('<collection>')
empty([<collection>])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String, Array, or Object | The collection to check |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`.
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to check |
| \<*searchText*\> | Yes | String | The ending substring to find |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object1*\>, \<*object2*\> | Yes | Various | The values, expressions, or objects to compare |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`.
Return the first item from a string or array.
```
first('<collection>')
first([<collection>])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection where to find the first item |
| Return value | Type | Description |
|---|---|---|
| \<*first-collection-item*\> | Any | The 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`
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>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The 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*\> | No | String | The 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 value | Type | Description |
|---|---|---|
| \<*float-value*\> | Float | The 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`
*Example 3*
Examples of unexpectedly valid inputs:
```
float('12,3,4,5678') //Returns 12345678
float('1234567,8+') //Returns 12345678
float('12345,6,78,-') //Returns -12345678
float('-12,345,678,') //Returns -12345678
float('12345678.-') //Returns -12345678
float('.12345678') //Returns 0.12345678
```
Return a timestamp in the specified format.
```
formatDateTime('<timestamp>', '<format>'?, '<locale>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. |
| \<*locale*\> | No | String | The locale to use. If unspecified, the value is `en-us`. If *locale* isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*reformatted-timestamp*\> | String | The 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'.
```
Return an array with values that match a key name in an action's *form-data* or *form-encoded* output.
```
formDataMultiValues('<actionName>', '<key>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The action whose output has the key value you want |
| \<*key*\> | Yes | String | The name for the key whose value you want |
| Return value | Type | Description |
|---|---|---|
| \[\<*array-with-key-values*\>\] | Array | An 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"]`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The action whose output has the key value you want |
| \<*key*\> | Yes | String | The name for the key whose value you want |
| Return value | Type | Description |
|---|---|---|
| \<*key-value*\> | String | The 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"`
Return a number as a string that's based on the specified format.
```
formatNumber(<number>, <format>, <locale>?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number*\> | Yes | Integer or Double | The value that you want to format. |
| \<*format*\> | Yes | String | A composite format string that specifies the format that you want to use. For the supported numeric format strings, see [Standard numeric format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings), which are supported by `number.ToString(<format>, <locale>)`. |
| \<*locale*\> | No | String | The 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 value | Type | Description |
|---|---|---|
| \<*formatted-number*\> | String | The 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.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.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')
```
Return the current timestamp plus the specified time units.
```
getFutureTime(<interval>, <timeUnit>, <format>?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*interval*\> | Yes | Integer | The number of time units to add |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | Either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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 value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Return the current timestamp minus the specified time units.
```
getPastTime(<interval>, <timeUnit>, <format>?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*interval*\> | Yes | Integer | The number of specified time units to subtract |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | Either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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 value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether greater than the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison value |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether greater than or equal to the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison value |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*format*\> | No | String | A single [format specifier](https://learn.microsoft.com/en-us/dotnet/api/system.guid.tostring#system_guid_tostring_system_string_) for the returned GUID. By default, the format is "D", but you can use "N", "D", "B", "P", or "X". |
| Return value | Type | Description |
|---|---|---|
| \<*GUID-value*\> | String | A 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)"`
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>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression*\> | Yes | Boolean | The expression to check |
| \<*valueIfTrue*\> | Yes | Any | The value to return when the expression is true |
| \<*valueIfFalse*\> | Yes | Any | The value to return when the expression is false |
| Return value | Type | Description |
|---|---|---|
| \<*specified-return-value*\> | Any | The 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')
```
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
| Return value | Type | Description |
|---|---|---|
| \<*index-value*\> | Integer | The 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`
Convert the string version for an integer to an actual integer number.
```
int('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string version for the integer to convert. The minimum and maximum values are the same as the limits for the integer data type. |
| Return value | Type | Description |
|---|---|---|
| \<*integer-result*\> | Integer | The 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`
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>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to examine |
| \<*locale*\> | No | String | The RFC 4646 locale code to use |
| Return value | Type | Description |
|---|---|---|
| \<*boolean-result*\> | Boolean | A 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`
Return a boolean that indicates whether a string is an integer.
```
isInt('<string>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*string*\> | Yes | String | The string to examine |
| Return value | Type | Description |
|---|---|---|
| \<*boolean-result*\> | Boolean | A 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`
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 value | Type | Description |
|---|---|---|
| \<*current-array-item*\> | Any | The 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
```
Return the current item from each cycle in a for-each loop. Use this function inside the for-each loop.
```
items('<loopName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*loopName*\> | Yes | String | The name for the for-each loop |
| Return value | Type | Description |
|---|---|---|
| \<*item*\> | Any | The 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')
```
Return the index value for the current iteration inside an Until loop. You can use this function inside nested Until loops.
```
iterationIndexes('<loopName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*loopName*\> | Yes | String | The name for the Until loop |
| Return value | Type | Description |
|---|---|---|
| \<*index*\> | Integer | The 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" ]
}
}
}
}
```
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.
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String or XML | The string or XML to convert |
| Return value | Type | Description |
|---|---|---|
| \<*JSON-result*\> | JSON native type, object, or array | The 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"
}
]
}
}
```
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>', ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection1*\>, \<*collection2*\>, ... | Yes | Array or Object, but not both | The collections from where you want *only* the common items |
| Return value | Type | Description |
|---|---|---|
| \<*common-items*\> | Array or Object, respectively | A 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]`
Return a string that has all the items from an array and has each character separated by a *delimiter*.
```
join([<collection>], '<delimiter>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The array that has the items to join |
| \<*delimiter*\> | Yes | String | The separator that appears between each character in the resulting string |
| Return value | Type | Description |
|---|---|---|
| \<*char1*\>\<*delimiter*\>\<*char2*\>\<*delimiter*\>... | String | The 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"`
Return the last item from a collection.
```
last('<collection>')
last([<collection>])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection where to find the last item |
| Return value | Type | Description |
|---|---|---|
| \<*last-collection-item*\> | String or Array, respectively | The 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
| Return value | Type | Description |
|---|---|---|
| \<*ending-index-value*\> | Integer | The 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', '')
```
Return the number of items in a collection.
```
length('<collection>')
length([<collection>])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection with the items to count |
| Return value | Type | Description |
|---|---|---|
| \<*length-or-count*\> | Integer | The 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether less than the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison item |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Integer, Float, or String | The first value to check whether less than or equal to the second value |
| \<*compareTo*\> | Yes | Integer, Float, or String, respectively | The comparison item |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
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 value | Type | Description |
|---|---|---|
| \<*callback-URL*\> | String | The 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*>"`
Return the highest value from a list or array with numbers that is inclusive at both ends.
```
max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number1*\>, \<*number2*\>, ... | Yes | Integer, Float, or both | The set of numbers from which you want the highest value |
| \[\<*number1*\>, \<*number2*\>, ...\] | Yes | Array - Integer, Float, or both | The array of numbers from which you want the highest value |
| Return value | Type | Description |
|---|---|---|
| \<*max-value*\> | Integer or Float | The 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`
Return the lowest value from a set of numbers or an array.
```
min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*number1*\>, \<*number2*\>, ... | Yes | Integer, Float, or both | The set of numbers from which you want the lowest value |
| \[\<*number1*\>, \<*number2*\>, ...\] | Yes | Array - Integer, Float, or both | The array of numbers from which you want the lowest value |
| Return value | Type | Description |
|---|---|---|
| \<*min-value*\> | Integer or Float | The 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`
Return the remainder from dividing two numbers. To get the integer result, see [div()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#div).
```
mod(<dividend>, <divisor>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*dividend*\> | Yes | Integer or Float | The number to divide by the *divisor* |
| \<*divisor*\> | Yes | Integer or Float | The number that divides the *dividend*, but can't be zero |
| Return value | Type | Description |
|---|---|---|
| \<*modulo-result*\> | Integer or Float | The 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`
Return the product from multiplying two numbers.
```
mul(<multiplicand1>, <multiplicand2>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*multiplicand1*\> | Yes | Integer or Float | The number to multiply by *multiplicand2* |
| \<*multiplicand2*\> | Yes | Integer or Float | The number that multiples *multiplicand1* |
| Return value | Type | Description |
|---|---|---|
| \<*product-result*\> | Integer or Float | The 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`
Return the body for a specific part in an action's output that has multiple parts.
```
multipartBody('<actionName>', <index>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action that has output with multiple parts |
| \<*index*\> | Yes | Integer | The index value for the part that you want |
| Return value | Type | Description |
|---|---|---|
| \<*body*\> | String | The body for the specified part |
Check whether an expression is false. Return true when the expression is false, or return false when true.
```
not(<expression>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression*\> | Yes | Boolean | The expression to check |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`.
Return the starting position or index value where the *n*th occurrence of a substring appears in a string.
```
nthIndexOf('<text>', '<searchText>', <occurrence>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that contains the substring to find |
| \<*searchText*\> | Yes | String | The substring to find |
| \<*occurrence*\> | Yes | Integer | A number that specifies the *n*th occurrence of the substring to find. If *occurrence* is negative, start searching from the end. |
| Return value | Type | Description |
|---|---|---|
| \<*index-value*\> | Integer | The starting position or index value for the *n*th 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`.
```
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>, ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*expression1*\>, \<*expression2*\>, ... | Yes | Boolean | The expressions to check |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`.
Return an action's outputs at runtime.
```
outputs('<actionName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*actionName*\> | Yes | String | The name for the action's output that you want |
| Return value | Type | Description |
|---|---|---|
| \<*output*\> | String | The 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"
}
}
```
Return the value for a parameter that is described in your workflow definition.
```
parameters('<parameterName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*parameterName*\> | Yes | String | The name for the parameter whose value you want |
| Return value | Type | Description |
|---|---|---|
| \<*parameter-value*\> | Any | The 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"`
Return the timestamp from a string that contains a timestamp.
```
parseDateTime('<timestamp>', '<locale>'?, '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*locale*\> | No | String | The locale to use. If not specified, the default locale is `en-us`.If *locale* isn't a valid value, an error is generated. |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/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 value | Type | Description |
|---|---|---|
| \<*parsed-timestamp*\> | String | The parsed timestamp in ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK) format, which complies with [ISO 8601](https://en.wikipedia.org/wiki/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'.
```
Return a random integer from a specified range, which is inclusive only at the starting end.
```
rand(<minValue>, <maxValue>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*minValue*\> | Yes | Integer | The lowest integer in the range |
| \<*maxValue*\> | Yes | Integer | The integer that follows the highest integer in the range that the function can return |
| Return value | Type | Description |
|---|---|---|
| \<*random-result*\> | Integer | The 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`
Return an integer array that starts from a specified integer.
```
range(<startIndex>, <count>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*startIndex*\> | Yes | Integer | An integer value that starts the array as the first item |
| \<*count*\> | Yes | Integer | The 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 value | Type | Description |
|---|---|---|
| \[\<*range-result*\>\] | Array | The 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]`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object from where you want to remove a property |
| \<*property*\> | Yes | String | The name for the property to remove |
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to remove |
| \<*parent-property*\> | Yes | String | The name for parent property with the child property that you want to remove |
| \<*child-property*\> | Yes | String | The name for the child property to remove |
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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 a substring with the specified string, and return the result string. This function is case-sensitive.
```
replace('<text>', '<oldText>', '<newText>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the substring to replace |
| \<*oldText*\> | Yes | String | The substring to replace |
| \<*newText*\> | Yes | String | The replacement string |
| Return value | Type | Description |
|---|---|---|
| \<*updated-text*\> | String | The 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"`
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](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-exception-handling#get-results-from-failures).
```
result('<scopedActionName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*scopedActionName*\> | Yes | String | The name of the scoped action where you want the inputs and outputs from the top-level actions inside that scope |
| Return value | Type | Description |
|---|---|---|
| \<*array-object*\> | Array object | An 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 the order of items in a collection. When you use this function with [sort()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#sort), you can sort a collection in descending order.
```
reverse([<collection>])
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection to reverse |
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The reversed collection |
*Example*
This example reverses an array of integers:
```
reverse(createArray(0, 1, 2, 3))
```
And returns this array: `[3,2,1,0]`
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#addProperty) function.
```
setProperty(<object>, '<property>', <value>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to set |
| \<*property*\> | Yes | String | The name for the existing or new property to set |
| \<*value*\> | Yes | Any | The 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>))
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*object*\> | Yes | Object | The JSON object whose property you want to set |
| \<*parent-property*\> | Yes | String | The name for parent property with the child property that you want to set |
| \<*child-property*\> | Yes | String | The name for the child property to set |
| \<*value*\> | Yes | Any | The value to set for the specified property |
| Return value | Type | Description |
|---|---|---|
| \<*updated-object*\> | Object | The 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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"
}
}
```
Remove items from the front of a collection, and return *all the other* items.
```
skip([<collection>], <count>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection whose items you want to remove |
| \<*count*\> | Yes | Integer | A positive integer for the number of items to remove at the front |
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The 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]`
Return a substring by specifying the starting and ending position or value. See also [substring()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#substring).
```
slice('<text>', <startIndex>, <endIndex>?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that contains the substring to find |
| \<*startIndex*\> | Yes | Integer | The 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*\> | No | Integer | The 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 value | Type | Description |
|---|---|---|
| \<*slice-result*\> | String | A 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 items in a collection. You can sort the collection objects using any key that contains a primitive data type supported by the Workflow Definition Language, such as **int**, **float**, **string**, or **bool**.
```
sort([<collection>], <sortBy>?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | Array | The collection with the items to sort |
| \<*sortBy*\> | No | String | The key to use for sorting the collection objects |
| Return value | Type | Description |
|---|---|---|
| \[\<*updated-collection*\>\] | Array | The 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" }')]`
Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.
```
split('<text>', '<delimiter>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to separate into substrings based on the specified delimiter in the original string |
| \<*delimiter*\> | Yes | String | The character in the original string to use as the delimiter |
| Return value | Type | Description |
|---|---|---|
| \[\<*substring1*\>,\<*substring2*\>,...\] | Array | An 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"]`
Return the start of the day for a timestamp.
```
startOfDay('<timestamp>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Return the start of the hour for a timestamp.
```
startOfHour('<timestamp>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Return the start of the month for a timestamp.
```
startOfMonth('<timestamp>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to check |
| \<*searchText*\> | Yes | String | The starting string to find |
| Return value | Type | Description |
|---|---|---|
| true or false | Boolean | Return 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`
Return the string version for a value.
```
string(<value>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | Any | The 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 value | Type | Description |
|---|---|---|
| \<*string-value*\> | String | The 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\\" }"`
Return the result from subtracting the second number from the first number.
```
sub(<minuend>, <subtrahend>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*minuend*\> | Yes | Integer or Float | The number from which to subtract the *subtrahend* |
| \<*subtrahend*\> | Yes | Integer or Float | The number to subtract from the *minuend* |
| Return value | Type | Description |
|---|---|---|
| \<*result*\> | Integer or Float | The 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`
Return characters from a string, starting from the specified position, or index. Index values start with the number 0. See also [slice()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#slice).
```
substring('<text>', <startIndex>, <length>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string whose characters you want |
| \<*startIndex*\> | Yes | Integer | A positive number equal to or greater than 0 that you want to use as the starting position or index value |
| \<*length*\> | No | Integer | A 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 value | Type | Description |
|---|---|---|
| \<*substring-result*\> | String | A 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"`
Subtract a number of time units from a timestamp. See also [getPastTime](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#getPastTime).
```
subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string that contains the timestamp |
| \<*interval*\> | Yes | Integer | The number of specified time units to subtract |
| \<*timeUnit*\> | Yes | String | The unit of time to use with *interval*: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year" |
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*updated-timestamp*\> | String | The 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"`
Return items from the front of a collection.
```
take('<collection>', <count>)
take([<collection>], <count>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection*\> | Yes | String or Array | The collection whose items you want |
| \<*count*\> | Yes | Integer | A positive integer for the number of items that you want from the front |
| Return value | Type | Description |
|---|---|---|
| \<*subset*\> or \[\<*subset*\>\] | String or Array, respectively | A 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]`
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)](https://learn.microsoft.com/en-us/dotnet/api/system.datetime.ticks).
```
ticks('<timestamp>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*timestamp*\> | Yes | String | The string for a timestamp |
| Return value | Type | Description |
|---|---|---|
| \<*ticks-number*\> | Integer | The number of ticks since the specified timestamp |
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to return in lowercase format |
| Return value | Type | Description |
|---|---|---|
| \<*lowercase-text*\> | String | The original string in lowercase format |
*Example*
This example converts this string to lowercase:
```
toLower('Hello World')
```
And returns this result: `"hello world"`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string to return in uppercase format |
| Return value | Type | Description |
|---|---|---|
| \<*uppercase-text*\> | String | The original string in uppercase format |
*Example*
This example converts this string to uppercase:
```
toUpper('Hello World')
```
And returns this result: `"HELLO WORLD"`
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerOutputs) and [triggerBody()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#triggerBody).
```
trigger()
```
| Return value | Type | Description |
|---|---|---|
| \<*trigger-output*\> | String | The output from a trigger at runtime |
Return a trigger's `body` output at runtime. Shorthand for `trigger().outputs.body`. See [trigger()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#trigger).
```
triggerBody()
```
| Return value | Type | Description |
|---|---|---|
| \<*trigger-body-output*\> | String | The `body` output from the trigger |
Return an array with values that match a key name in a trigger's *form-data* or *form-encoded* output.
```
triggerFormDataMultiValues('<key>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*key*\> | Yes | String | The name for the key whose value you want |
| Return value | Type | Description |
|---|---|---|
| \[\<*array-with-key-values*\>\] | Array | An 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"]`
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>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*key*\> | Yes | String | The name for the key whose value you want |
| Return value | Type | Description |
|---|---|---|
| \<*key-value*\> | String | The 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"`
Return the body for a specific part in a trigger's output that has multiple parts.
```
triggerMultipartBody(<index>)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*index*\> | Yes | Integer | The index value for the part that you want |
| Return value | Type | Description |
|---|---|---|
| \<*body*\> | String | The body for the specified part in a trigger's multipart output |
Return a trigger's output at runtime, or values from other JSON name-and-value pairs. Shorthand for `trigger().outputs`. See [trigger()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#trigger).
```
triggerOutputs()
```
| Return value | Type | Description |
|---|---|---|
| \<*trigger-output*\> | String | The output from a trigger at runtime |
Remove leading and trailing whitespace from a string, and return the updated string.
```
trim('<text>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*text*\> | Yes | String | The string that has the leading and trailing whitespace to remove |
| Return value | Type | Description |
|---|---|---|
| \<*updatedText*\> | String | An 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"`
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>], ...)
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*collection1*\>, \<*collection2*\>, ... | Yes | Array or Object, but not both | The collections from where you want *all* the items |
| Return value | Type | Description |
|---|---|---|
| \<*updatedCollection*\> | Array or Object, respectively | A 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]`
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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#encodeUriComponent). Although both functions work the same way, `uriComponent()` is preferred.
```
uriComponent('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The string to convert to URI-encoded format |
| Return value | Type | Description |
|---|---|---|
| \<*encoded-uri*\> | String | The 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"`
Return the binary version for a uniform resource identifier (URI) component.
```
uriComponentToBinary('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The URI-encoded string to convert |
| Return value | Type | Description |
|---|---|---|
| \<*binary-for-encoded-uri*\> | String | The 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: `"aHR0cHM6Ly9jb250b3NvLmNvbQ=="`
Return the string version for a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.
```
uriComponentToString('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The URI-encoded string to decode |
| Return value | Type | Description |
|---|---|---|
| \<*decoded-uri*\> | String | The 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"`
Return the `host` value for a uniform resource identifier (URI).
```
uriHost('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `host` value you want |
| Return value | Type | Description |
|---|---|---|
| \<*host-value*\> | String | The `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"`
Return the `path` value for a uniform resource identifier (URI).
```
uriPath('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `path` value you want |
| Return value | Type | Description |
|---|---|---|
| \<*path-value*\> | String | The `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"`
Return the `path` and `query` values for a uniform resource identifier (URI).
```
uriPathAndQuery('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `path` and `query` values you want |
| Return value | Type | Description |
|---|---|---|
| \<*path-query-value*\> | String | The `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"`
Return the `port` value for a uniform resource identifier (URI).
```
uriPort('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `port` value you want |
| Return value | Type | Description |
|---|---|---|
| \<*port-value*\> | Integer | The `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`
Return the `query` value for a uniform resource identifier (URI).
```
uriQuery('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `query` value you want |
| Return value | Type | Description |
|---|---|---|
| \<*query-value*\> | String | The `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"`
Return the `scheme` value for a uniform resource identifier (URI).
```
uriScheme('<uri>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*uri*\> | Yes | String | The URI whose `scheme` value you want |
| Return value | Type | Description |
|---|---|---|
| \<*scheme-value*\> | String | The `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"`
Return the current timestamp.
```
utcNow('<format>')
```
Optionally, you can specify a different format with the \<*format*\> parameter.
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*format*\> | No | String | A numeric format string that is either a [single format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) or a [custom format pattern](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings). The default format for the timestamp is ["o"](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) (yyyy-MM-ddTHH:mm:ss.fffffffK), which complies with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) and preserves time zone information. If the format isn't a valid value, an error is generated. |
| Return value | Type | Description |
|---|---|---|
| \<*current-timestamp*\> | String | The current date and time |
*Examples*
```
utcNow() // Returns 2025-09-25T05:18:31.3384797Z
utcNow('u') // Returns 2025-09-25 05:18:31Z
utcNow('U') // Returns Thursday, September 25, 2025 5:18:31 AM
utcNow('d') // Returns 9/25/2025
utcNow('D') // Returns Thursday, September 25, 2025
utcNow('t') // Returns 5:18 AM
utcNow('T') // Returns 5:18:31 AM
utcNow('y') // Returns September 2025
utcNow('yyyy') // Returns 2025
utcNow('ddd, d MMM yyyy') // Returns Thu, 25 Sep 2025
```
Return the value for a specified variable.
```
variables('<variableName>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*variableName*\> | Yes | String | The name for the variable whose value you want |
| Return value | Type | Description |
|---|---|---|
| \<*variable-value*\> | Any | The 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`
Return all the details about the workflow itself during run time.
```
workflow().<property>
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*property*\> | No | String | The 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](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources) 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](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources).**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>`
Return the XML version for a string that contains a JSON object.
```
xml('<value>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*value*\> | Yes | String | The 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 value | Type | Description |
|---|---|---|
| \<*xml-version*\> | Object | The 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>
```
*Example 4*
The `xml()` function expects either an object or a string containing valid XML. The function doesn't accept a raw array as input.
If you have a JSON array, like the following example, you have four options.
```
[
{ "ID": 1, "Name": "James" },
{ "ID": 2, "Name": "John" },
{ "ID": 3, "Name": "Sam" }
]
```
Option 1: Convert the JSON string to a JSON object before you pass the result to the `xml()` function, for example:
```
xml(
json('{"root":{"array":[
{ "ID": 1, "Name": "James" },
{ "ID": 2, "Name": "John" },
{ "ID": 3, "Name": "Sam" }
]}}')
)
```
Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**, and store the returned JSON object in another **Compose** action named **Compose2**.
```
{
"root": { "array": @{outputs('Compose1')} }
}
```
You can then use the `xml()` and `outputs()` functions to create XML from the JSON object output from **Compose2**, for example:
```
xml(outputs('Compose2'))
```
Option 3: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()`, `concat()`, `json()`, and `xml()` functions to create XML from the JSON object output, for example:
```
xml(
json(
concat(
'{"root":{"array":',
outputs('Compose1'),
'}}'
)
)
)
```
Option 4: Similar to option 3, but uses `addProperty()` instead of the `concat()` function to create the JSON object before passing it to the `xml()` function, for example:
```
xml(
addProperty(
json('{}'),
'root',
addProperty(
json('{}'),
'array',
outputs('Compose1')
)
)
)
```
All the examples from options 1 to 4 return the following XML result:
```
<root>
<array>
<ID>1</ID>
<Name>James</Name>
</array>
<array>
<ID>2</ID>
<Name>John</Name>
</array>
<array>
<ID>3</ID>
<Name>Sam</Name>
</array>
</root>
```
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](https://learn.microsoft.com/en-us/dotnet/api/system.xml.xpath). XPath expressions are compatible with the underlying .NET library and support only the expression that the underlying .NET library supports.
```
xpath('<xml>', '<xpath>')
```
| Parameter | Required | Type | Description |
|---|---|---|---|
| \<*xml*\> | Yes | Any | The XML string to search for nodes or values that match an XPath expression value |
| \<*xpath*\> | Yes | Any | The XPath expression used to find matching XML nodes or values |
| Return value | Type | Description |
|---|---|---|
| \<*xml-node*\> | XML | An XML node when only a single node matches the specified XPath expression |
| \<*value*\> | Any | The value from an XML node when only a single value matches the specified XPath expression |
| \[\<*xml-node1*\>, \<*xml-node2*\>, ...\] -or- \[\<*value1*\>, \<*value2*\>, ...\] | Array | An 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()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#parameters) function to get the XML string from `'items'` and convert the string to XML format by using the [xml()](https://learn.microsoft.com/en-us/azure/logic-apps/expression-functions-reference#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>
<name expired='true'>Gala</name>
<type>apple</type>
<count>20</count>
</item>
<item>
<name expired='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>
<name expired='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>
<name expired='true' price='12'>Gala</name>
<type>apple</type>
<count>20</count>
</item>
<item>
<name expired='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"?><file xmlns="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`
Learn about the [Workflow Definition Language](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language) |
| Shard | 168 (laksa) |
| Root Hash | 14615152987638977768 |
| Unparsed URL | com,microsoft!learn,/en-us/azure/logic-apps/expression-functions-reference s443 |