Workflow Definition Language schema for Azure Logic Apps

A workflow definition contains the actual logic that executes as a part of your logic app. This definition includes one or more triggers that start the logic app, and one or more actions for the logic app to take.

Basic workflow definition structure

Here is the basic structure of a workflow definition:

{
    "$schema": "<schema-of the-definition>",
    "contentVersion": "<version-number-of-definition>",
    "parameters": { <parameter-definitions-of-definition> },
    "triggers": [ { <definition-of-flow-triggers> } ],
    "actions": [ { <definition-of-flow-actions> } ],
    "outputs": { <output-of-definition> }
}
Note

The Workflow Management REST API documentation has information on how to create and manage logic app workflows.

Element name Required Description
$schema No Specifies the location for the JSON schema file that describes the version of the definition language. This location is required when you reference a definition externally. For this document, the location is:

https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2015-08-01-preview/workflowdefinition.json#

contentVersion No Specifies the definition version. When you deploy a workflow using the definition, you can use this value to make sure that the right definition is used.
parameters No Specifies parameters used to input data into the definition. A maximum of 50 parameters can be defined.
triggers No Specifies information for the triggers that initiate the workflow. A maximum of 10 triggers can be defined.
actions No Specifies actions that are taken as the flow executes. A maximum of 250 actions can be defined.
outputs No Specifies information about the deployed resource. A maximum of 10 outputs can be defined.

Parameters

This section specifies all the parameters that are used in the workflow definition at deployment time. All parameters must be declared in this section before they can be used in other sections of the definition.

The following example shows the structure of a parameter definition:

"parameters": {
    "<parameter-name>" : {
        "type" : "<type-of-parameter-value>",
        "defaultValue": <default-value-of-parameter>,
        "allowedValues": [ <array-of-allowed-values> ],
        "metadata" : { "key": { "name": "value"} }
    }
}
Element name Required Description
type Yes Type: string

Declaration: "parameters": {"parameter1": {"type": "string"}

Specification: "parameters": {"parameter1": {"value": "myparamvalue1"}}

Type: securestring

Declaration: "parameters": {"parameter1": {"type": "securestring"}}

Specification: "parameters": {"parameter1": {"value": "myparamvalue1"}}

Type: int

Declaration: "parameters": {"parameter1": {"type": "int"}}

Specification: "parameters": {"parameter1": {"value" : 5}}

Type: bool

Declaration: "parameters": {"parameter1": {"type": "bool"}}

Specification: "parameters": {"parameter1": { "value": true }}

Type: array

Declaration: "parameters": {"parameter1": {"type": "array"}}

Specification: "parameters": {"parameter1": { "value": [ array-of-values ]}}

Type: object

Declaration: "parameters": {"parameter1": {"type": "object"}}

Specification: "parameters": {"parameter1": { "value": { JSON-object } }}

Type: secureobject

Declaration: "parameters": {"parameter1": {"type": "object"}}

Specification: "parameters": {"parameter1": { "value": { JSON-object } }}

Note: The securestring and secureobject types are not returned in GET operations. All passwords, keys, and secrets should use this type.

defaultValue No Specifies the default value for the parameter when no value is specified at the time the resource is created.
allowedValues No Specifies an array of allowed values for the parameter.
metadata No Specifies additional information about the parameter, such as a readable description or design-time data used by Visual Studio or other tools.

This example shows how you can use a parameter in the body section of an action:

"body" :
{
  "property1": "@parameters('parameter1')"
}

Parameters can also be used in outputs.

Triggers and actions

Triggers and actions specify the calls that can participate in workflow execution. For details about this section, see Workflow Actions and Triggers.

Outputs

Outputs specify information that can be returned from a workflow run. For example, if you have a specific status or value that you want to track for each run, you can include that data in the run outputs. The data appears in the Management REST API for that run, and in the management UI for that run in the Azure portal. You can also flow these outputs to other external systems like PowerBI for creating dashboards. Outputs are not used to respond to incoming requests on the Service REST API. To respond to an incoming request using the response action type, here's an example:

"outputs": {  
  "key1": {  
    "value": "value1",  
    "type" : "<type-of-value>"  
  }  
} 
Element name Required Description
key1 Yes Specifies the key identifier for the output. Replace key1 with a name that you want to use to identify the output.
value Yes Specifies the value of the output.
type Yes Specifies the type for the value that was specified. Possible types of values are:
  • string
  • securestring
  • int
  • bool
  • array
  • object

Expressions

JSON values in the definition can be literal, or they can be expressions that are evaluated when the definition is used. For example:

"name": "value"

or

"name": "@parameters('password') "
Note

Some expressions get their values from runtime actions that might not exist at the beginning of the execution. You can use functions to help retrieve some of these values.

Expressions can appear anywhere in a JSON string value and always result in another JSON value. When a JSON value has been determined to be an expression, the body of the expression is extracted by removing the at-sign (@). If a literal string is needed that starts with @, that string must be escaped by using @@. The following examples show how expressions are evaluated.

JSON value Result
"parameters" The characters 'parameters' are returned.
"parameters[1]" The characters 'parameters[1]' are returned.
"@@" A 1 character string that contains '@' is returned.
" @" A 2 character string that contains ' @' is returned.

With string interpolation, expressions can also appear inside strings where expressions are wrapped in @{ ... }. For example:

"name" : "First Name: @{parameters('firstName')} Last Name: @{parameters('lastName')}"

The result is always a string, which makes this feature similar to the concat function. Suppose you defined myNumber as 42 and myString as sampleString:

JSON value Result
"@parameters('myString')" Returns sampleString as a string.
"@{parameters('myString')}" Returns sampleString as a string.
"@parameters('myNumber')" Returns 42 as a number.
"@{parameters('myNumber')}" Returns 42 as a string.
"Answer is: @{parameters('myNumber')}" Returns the string Answer is: 42.
"@concat('Answer is: ', string(parameters('myNumber')))" Returns the string Answer is: 42
"Answer is: @@{parameters('myNumber')}" Returns the string Answer is: @{parameters('myNumber')}.

Operators

Operators are the characters that you can use inside expressions or functions.

Operator Description
. The dot operator allows you to reference properties of an object
? The question mark operator lets you reference null properties of an object without a runtime error. For example, you can use this expression to handle null trigger outputs:

@coalesce(trigger().outputs?.body?.property1, 'my default value')

' The single quotation mark is the only way to wrap string literals. You cannot use double-quotes inside expressions because this punctuation conflicts with the JSON quote that wraps the whole expression.
[] The square brackets can be used to get a value from an array with a specific index. For example, if you have an action that passes range(0,10)in to the forEach function, you can use this function to get items out of arrays:

myArray[item()]

Functions

You can also call functions within expressions. The following table shows the functions that can be used in an expression.

Expression Evaluation
"@function('Hello')" Calls the function member of the definition with the literal string Hello as the first parameter.
"@function('It's Cool!')" Calls the function member of the definition with the literal string 'It's Cool!' as the first parameter
"@function().prop1" Returns the value of the prop1 property of the myfunction member of the definition.
"@function('Hello').prop1" Calls the function member of the definition with the literal string 'Hello' as the first parameter and returns the prop1 property of the object.
"@function(parameters('Hello'))" Evaluates the Hello parameter and passes the value to function

Referencing functions

You can use these functions to reference outputs from other actions in the logic app or values passed in when the logic app was created. For example, you can reference the data from one step to use it in another.

Function name Description
parameters Returns a parameter value that is defined in the definition.

parameters('password')

Parameter number: 1

Name: Parameter

Description: Required. The name of the parameter whose values you want.

action Enables an expression to derive its value from other JSON name and value pairs or the output of the current runtime action. The property represented by propertyPath in the following example is optional. If propertyPath is not specified, the reference is to the whole action object. This function can only be used inside do-until conditions of an action.

action().outputs.body.propertyPath

actions Enables an expression to derive its value from other JSON name and value pairs or the output of the runtime action. These expressions explicitly declare that one action depends on another action. The property represented by propertyPath in the following example is optional. If propertyPath is not specified, the reference is to the whole action object. You can use either this element or the conditions element to specify dependencies, but you do not need to use both for the same dependent resource.

actions('myAction').outputs.body.propertyPath

Parameter number: 1

Name: Action name

Description: Required. The name of the action whose values you want.

Available properties on the action object are:

  • name
  • startTime
  • endTime
  • inputs
  • outputs
  • status
  • code
  • trackingId
  • clientTrackingId

See the Rest API for details on those properties.

trigger Enables an expression to derive its value from other JSON name and value pairs or the output of the runtime trigger. The property represented by propertyPath in the following example is optional. If propertyPath is not specified, the reference is to the whole trigger object.

trigger().outputs.body.propertyPath

When used inside a trigger's inputs, the function returns the outputs of the previous execution. However, when used inside a trigger's condition, the trigger function returns the outputs of the current execution.

Available properties on the trigger object are:

  • name
  • scheduledTime
  • startTime
  • endTime
  • inputs
  • outputs
  • status
  • code
  • trackingId
  • clientTrackingId

See the Rest API for details on those properties.

actionOutputs This function is shorthand for actions('actionName').outputs

Parameter number: 1

Name: Action name

Description: Required. The name of the action whose values you want.

actionBody and body These functions are shorthand for actions('actionName').outputs.body

Parameter number: 1

Name: Action name

Description: Required. The name of the action whose values you want.

triggerOutputs This function is shorthand for trigger().outputs
triggerBody This function is shorthand for trigger().outputs.body
item When used inside a repeating action, this function returns the item that is in the array for this iteration of the action. For example, if you have an action that runs for each item an array of messages, you can use this syntax:

"input1" : "@item().subject"

Collection functions

These functions operate over collections and generally apply to Arrays, Strings, and sometimes Dictionaries.

Function name Description
contains Returns true if dictionary contains a key, list contains value, or string contains substring. For example, this function returns true:

contains('abacaba','aca')

Parameter number: 1

Name: Within collection

Description: Required. The collection to search within.

Parameter number: 2

Name: Find object

Description: Required. The object to find inside the Within collection.

length Returns the number of elements in an array or string. For example, this function returns 3:

length('abc')

Parameter number: 1

Name: Collection

Description: Required. The collection for which to get the length.

empty Returns true if object, array, or string is empty. For example, this function returns true:

empty('')

Parameter number: 1

Name: Collection

Description: Required. The collection to check if it is empty.

intersection Returns a single array or object that has common elements between arrays or objects passed in. For example, this function returns [1, 2]:

intersection([1, 2, 3], [101, 2, 1, 10],[6, 8, 1, 2])

The parameters for the function can either be a set of objects or a set of arrays (not a mixture of both). If there are two objects with the same name, the last object with that name appears in the final object.

Parameter number: 1 ... n

Name: Collection n

Description: Required. The collections to evaluate. An object must be in all collections passed in to appear in the result.

union Returns a single array or object with all the elements that are in either array or object passed to this function. For example, this function returns [1, 2, 3, 10, 101]:

union([1, 2, 3], [101, 2, 1, 10])

The parameters for the function can either be a set of objects or a set of arrays (not a mixture thereof). If there are two objects with the same name in the final output, the last object with that name appears in the final object.

Parameter number: 1 ... n

Name: Collection n

Description: Required. The collections to evaluate. An object that appears in any of the collections also appears in the result.

first Returns the first element in the array or string passed in. For example, this function returns 0:

first([0,2,3])

Parameter number: 1

Name: Collection

Description: Required. The collection to take the first object from.

last Returns the last element in the array or string passed in. For example, this function returns 3:

last('0123')

Parameter number: 1

Name: Collection

Description: Required. The collection to take the last object from.

take Returns the first Count elements from the array or string passed in. For example, this function returns [1, 2]:

take([1, 2, 3, 4], 2)

Parameter number: 1

Name: Collection

Description: Required. The collection from where to take the first Count objects.

Parameter number: 2

Name: Count

Description: Required. The number of objects to take from the Collection. Must be a positive integer.

skip Returns the elements in the array starting at index Count. For example, this function returns [3, 4]:

skip([1, 2 ,3 ,4], 2)

Parameter number: 1

Name: Collection

Description: Required. The collection to skip the first Count objects from.

Parameter number: 2

Name: Count

Description: Required. The number of objects to remove from the front of Collection. Must be a positive integer.

join Returns a string with each item of an array joined by a delimiter, for example this returns "1,2,3,4":

join([1, 2, 3, 4], ',')

Parameter number: 1

Name: Collection

Description: Required. The collection to join items from.

Parameter number: 2

Name: Delimiter

Description: Required. The string to delimit items with.

String functions

The following functions only apply to strings. You can also use some collection functions on strings.

Function name Description
concat Combines any number of strings together. For example, if parameter 1 is p1, this function returns somevalue-p1-somevalue:

concat('somevalue-',parameters('parameter1'),'-somevalue')

Parameter number: 1 ... n

Name: String n

Description: Required. The strings to combine into a single string.

substring Returns a subset of characters from a string. For example, this function returns abc:

substring('somevalue-abc-somevalue',10,3)

Parameter number: 1

Name: String

Description: Required. The string from which the substring is taken.

Parameter number: 2

Name: Start index

Description: Required. The index of where the substring begins in parameter 1.

Parameter number: 3

Name: Length

Description: Required. The length of the substring.

replace Replaces a string with a given string. For example, this function returns the new string:

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

Parameter number: 1

Name: string

Description: Required. The string that is searched for parameter 2 and updated with parameter 3, when parameter 2 is found in parameter 1.

Parameter number: 2

Name: Old string

Description: Required. The string to replace with parameter 3, when a match is found in parameter 1

Parameter number: 3

Name: New string

Description: Required. The string that is used to replace the string in parameter 2 when a match is found in parameter 1.

guid This function generates a globally unique string (GUID). For example, this function can generate this GUID: c2ecc88d-88c8-4096-912c-d6f2e2b138ce

guid()

Parameter number: 1

Name: Format

Description: Optional. A single format specifier that indicates how to format the value of this Guid. The format parameter can be "N", "D", "B", "P", or "X". If format is not provided, "D" is used.

toLower Converts a string to lowercase. For example, this function returns two by two is four:

toLower('Two by Two is Four')

Parameter number: 1

Name: String

Description: Required. The string to convert to lower casing. If a character in the string does not have a lowercase equivalent, the character is included unchanged in the returned string.

toUpper Converts a string to uppercase. For example, this function returns TWO BY TWO IS FOUR:

toUpper('Two by Two is Four')

Parameter number: 1

Name: String

Description: Required. The string to convert to upper casing. If a character in the string does not have an uppercase equivalent, the character is included unchanged in the returned string.

indexof Find the index of a value within a string case insensitively. For example, this function returns 7:

indexof('hello, world.', 'world')

Parameter number: 1

Name: String

Description: Required. The string that may contain the value.

Parameter number: 2

Name: String

Description: Required. The value to search the index of.

lastindexof Find the last index of a value within a string case insensitively. For example, this function returns 3:

lastindexof('foofoo', 'foo')

Parameter number: 1

Name: String

Description: Required. The string that may contain the value.

Parameter number: 2

Name: String

Description: Required. The value to search the index of.

startswith Checks if the string starts with a value case insensitively. For example, this function returns true:

startswith('hello, world', 'hello')

Parameter number: 1

Name: String

Description: Required. The string that may contain the value.

Parameter number: 2

Name: String

Description: Required. The value the string may start with.

endswith Checks if the string ends with a value case insensitively. For example, this function returns true:

endswith('hello, world', 'world')

Parameter number: 1

Name: String

Description: Required. The string that may contain the value.

Parameter number: 2

Name: String

Description: Required. The value the string may end with.

split Splits the string using a separator. For example, this function returns ["a", "b", "c"]:

split('a;b;c',';')

Parameter number: 1

Name: String

Description: Required. The string that is split.

Parameter number: 2

Name: String

Description: Required. The separator.

Logical functions

These functions are useful inside conditions and can be used to evaluate any type of logic.

Function name Description
equals Returns true if two values are equal. For example, if parameter1 is someValue, this function returns true:

equals(parameters('parameter1'), 'someValue')

Parameter number: 1

Name: Object 1

Description: Required. The object to compare to Object 2.

Parameter number: 2

Name: Object 2

Description: Required. The object to compare to Object 1.

less Returns true if the first argument is less than the second. Note, values can only be of type integer, float, or string. For example, this function returns true:

less(10,100)

Parameter number: 1

Name: Object 1

Description: Required. The object to check if it is less than Object 2.

Parameter number: 2

Name: Object 2

Description: Required. The object to check if it is greater than Object 1.

lessOrEquals Returns true if the first argument is less than or equal to the second. Note, values can only be of type integer, float, or string. For example, this function returns true:

lessOrEquals(10,10)

Parameter number: 1

Name: Object 1

Description: Required. The object to check if it is less or equal to Object 2.

Parameter number: 2

Name: Object 2

Description: Required. The object to check if it is greater than or equal to Object 1.

greater Returns true if the first argument is greater than the second. Note, values can only be of type integer, float, or string. For example, this function returns false:

greater(10,10)

Parameter number: 1

Name: Object 1

Description: Required. The object to check if it is greater than Object 2.

Parameter number: 2

Name: Object 2

Description: Required. The object to check if it is less than Object 1.

greaterOrEquals Returns true if the first argument is greater than or equal to the second. Note, values can only be of type integer, float, or string. For example, this function returns false:

greaterOrEquals(10,100)

Parameter number: 1

Name: Object 1

Description: Required. The object to check if it is greater than or equal to Object 2.

Parameter number: 2

Name: Object 2

Description: Required. The object to check if it is less than or equal to Object 1.

and Returns true if both parameters are true. Both arguments need to be Booleans. For example, this function returns false:

and(greater(1,10),equals(0,0))

Parameter number: 1

Name: Boolean 1

Description: Required. The first argument that must be true.

Parameter number: 2

Name: Boolean 2

Description: Required. The second argument must be true.

or Returns true if either parameter is true. Both arguments need to be Booleans. For example, this function returns true:

or(greater(1,10),equals(0,0))

Parameter number: 1

Name: Boolean 1

Description: Required. The first argument that may be true.

Parameter number: 2

Name: Boolean 2

Description: Required. The second argument may be true.

not Returns true if the parameters are false. Both arguments need to be Booleans. For example, this function returns true:

not(contains('200 Success','Fail'))

Parameter number: 1

Name: Boolean

Description: Returns true if the parameters are false. Both arguments need to be Booleans. This function returns true: not(contains('200 Success','Fail'))

if Returns a specified value based on whether the expression resulted in true or false. For example, this function returns "yes":

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

Parameter number: 1

Name: Expression

Description: Required. A boolean value that determines which value the expression should return.

Parameter number: 2

Name: True

Description: Required. The value to return if the expression is true.

Parameter number: 3

Name: False

Description: Required. The value to return if the expression is false.

Conversion functions

These functions are used to convert between each of the native types in the language:

  • string

  • integer

  • float

  • boolean

  • arrays

  • dictionaries

  • forms

Function name Description
int Convert the parameter to an integer. For example, this function returns 100 as a number, rather than a string:

int('100')

Parameter number: 1

Name: Value

Description: Required. The value that is converted to an integer.

string Convert the parameter to a string. For example, this function returns '10':

string(10)

You can also convert an object to a string. For example, if the myPar parameter is an object with one property abc : xyz, then this function returns {"abc" : "xyz"}:

string(parameters('myPar'))

Parameter number: 1

Name: Value

Description: Required. The value that is converted to a string.

json Convert the parameter to a JSON type value and is the opposite of string(). For example, this function returns [1,2,3] as an array, rather than a string:

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

Likewise, you can convert a string to an object. For example, this function returns { "abc" : "xyz" }:

json('{"abc" : "xyz"}')

Parameter number: 1

Name: String

Description: Required. The string that is converted to a native type value.

The json() function supports XML input too. For example, the parameter value of:

<?xml version="1.0"?> <root> <person id='1'> <name>Alan</name> <occupation>Engineer</occupation> </person> </root>

is converted to this JSON:

{ "?xml": { "@version": "1.0" }, "root": { "person": [ { "@id": "1", "name": "Alan", "occupation": "Engineer" } ] } }

float Convert the parameter argument to a floating-point number. For example, this function returns 10.333:

float('10.333')

Parameter number: 1

Name: Value

Description: Required. The value that is converted to a floating-point number.

bool Convert the parameter to a Boolean. For example, this function returns false:

bool(0)

Parameter number: 1

Name: Value

Description: Required. The value that is converted to a boolean.

coalesce Returns the first non-null object in the arguments passed in. Note: An empty string is not null. For example, if parameters 1 and 2 are not defined, this function returns fallback:

coalesce(parameters('parameter1'), parameters('parameter2') ,'fallback')

Parameter number: 1 ... n

Name: Objectn

Description: Required. The objects to check for null.

base64 Returns the base64 representation of the input string. For example, this function returns c29tZSBzdHJpbmc=:

base64('some string')

Parameter number: 1

Name: String 1

Description: Required. The string to encode into base64 representation.

base64ToBinary Returns a binary representation of a base64 encoded string. For example, this function returns the binary representation of some string:

base64ToBinary('c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Required. The base64 encoded string.

base64ToString Returns a string representation of a based64 encoded string. For example, this function returns some string:

base64ToString('c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Required. The base64 encoded string.

Binary Returns a binary representation of a value. For example, this function returns a binary representation of some string:

binary('some string')

Parameter number: 1

Name: Value

Description: Required. The value that is converted to binary.

dataUriToBinary Returns a binary representation of a data URI. For example, this function returns the binary representation of some string:

dataUriToBinary('data:;base64,c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Required. The data URI to convert to binary representation.

dataUriToString Returns a string representation of a data URI. For example, this function returns some string:

dataUriToString('data:;base64,c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Required. The data URI to convert to String representation.

dataUri Returns a data URI of a value. For example, this function returns this data URI text/plain;charset=utf8;base64,c29tZSBzdHJpbmc=:

dataUri('some string')

Parameter number: 1

Name: Value

Description: Required. The value to convert to data URI.

decodeBase64 Returns a string representation of an input based64 string. For example, this function returns some string:

decodeBase64('c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Returns a string representation of an input based64 string.

encodeUriComponent URL-escapes the string that's passed in. For example, this function returns You+Are%3ACool%2FAwesome:

encodeUriComponent('You Are:Cool/Awesome')

Parameter number: 1

Name: String

Description: Required. The string to escape URL-unsafe characters from.

decodeUriComponent Un-URL-escapes the string that's passed in. For example, this function returns You Are:Cool/Awesome:

encodeUriComponent('You+Are%3ACool%2FAwesome')

Parameter number: 1

Name: String

Description: Required. The string to decode the URL-unsafe characters from.

decodeDataUri Returns a binary representation of an input data URI string. For example, this function returns the binary representation of some string:

decodeDataUri('data:;base64,c29tZSBzdHJpbmc=')

Parameter number: 1

Name: String

Description: Required. The dataURI to decode into a binary representation.

uriComponent Returns a URI encoded representation of a value. For example, this function returns You+Are%3ACool%2FAwesome:

uriComponent('You Are:Cool/Awesome')

Parameter number: 1

Name: String

Description: Required. The string to be URI encoded.

uriComponentToBinary Returns a binary representation of a URI encoded string. For example, this function returns a binary representation of You Are:Cool/Awesome:

uriComponentToBinary('You+Are%3ACool%2FAwesome')

Parameter number: 1

Name: String

Description: Required. The URI encoded string.

uriComponentToString Returns a string representation of a URI encoded string. For example, this function returns You Are:Cool/Awesome:

uriComponentToBinary('You+Are%3ACool%2FAwesome')

Parameter number: 1

Name: String

Description: Required. The URI encoded string.

xml Return an XML representation of the value. For example, this function returns XML content represented by '\<name>Alan\</name>':

xml('\<name>Alan\</name>')

The xml() function supports JSON object input too. For example, the parameter { "abc": "xyz" } is converted to XML content: \<abc>xyz\</abc>

Parameter number: 1

Name: Value

Description: Required. The value to convert to XML.

xpath Return an array of XML nodes matching the xpath expression of a value that the xpath expression evaluates to.

Example 1

Assume the value of parameter p1 is a string representation of this XML:

<?xml version="1.0"?> <lab> <robot> <parts>5</parts> <name>R1</name> </robot> <robot> <parts>8</parts> <name>R2</name> </robot> </lab>

This code: xpath(xml(parameters('p1'), '/lab/robot/name')

returns

[ <name>R1</name>, <name>R2</name> ]

while this code:

xpath(xml(parameters('p1'), ' sum(/lab/robot/parts)')

returns

13

Example 2

Given the following XML content:

<?xml version="1.0"?> <File xmlns="http://foo.com"> <Location>bar</Location> </File>

This code: @xpath(xml(body('Http')), '/*[name()=\"File\"]/*[name()=\"Location\"]')

or this code:

@xpath(xml(body('Http')), '/*[local-name()=\"File\" and namespace-uri()=\"http://foo.com\"]/*[local-name()=\"Location\" and namespace-uri()=\"\"]')

returns

<Location xmlns="http://abc.com">xyz</Location>

And this code: @xpath(xml(body('Http')), 'string(/*[name()=\"File\"]/*[name()=\"Location\"])')

returns

xyz

Parameter number: 1

Name: Xml

Description: Required. The XML on which to evaluate the XPath expression.

Parameter number: 2

Name: XPath

Description: Required. The XPath expression to evaluate.

array Convert the parameter to an array. For example, this function returns ["abc"]:

array('abc')

Parameter number: 1

Name: Value

Description: Required. The value that is converted to an array.

createArray Creates an array from the parameters. For example, this function returns ["a", "c"]:

createArray('a', 'c')

Parameter number: 1 ... n

Name: Any n

Description: Required. The values to combine into an array.

triggerFormDataValue Returns a single value matching the key name from form-data or form-encoded trigger output. If there are multiple matches it will error. For example, the following will return bar: triggerFormDataValue('foo')

Parameter number: 1

Name: Key Name

Description: Required. The key name of the form data value to return.
triggerFormDataMultiValues Returns an array of values matching the key name from form-data or form-encoded trigger output. For example, the following will return ["bar"]: triggerFormDataValue('foo')

Parameter number: 1

Name: Key Name

Description: Required. The key name of the form data values to return.
triggerMultipartBody Returns the body for a part in a multipart output of the trigger.

Parameter number: 1

Name: Index

Description: Required. The index of the part to retrieve.
formDataValue Returns a single value matching the key name from form-data or form-encoded action output. If there are multiple matches it will error. For example, the following will return bar: formDataValue('someAction', 'foo')

Parameter number: 1

Name: Action Name

Description: Required. The name of the action with a form-data or form-encoded response.

Parameter number: 2

Name: Key Name

Description: Required. The key name of the form data value to return.
formDataMultiValues Returns an array of values matching the key name from form-data or form-encoded action output. For example, the following will return ["bar"]: formDataMultiValues('someAction', 'foo')

Parameter number: 1

Name: Action Name

Description: Required. The name of the action with a form-data or form-encoded response.

Parameter number: 2

Name: Key Name

Description: Required. The key name of the form data values to return.
multipartBody Returns the body for a part in a multipart output of an action.

Parameter number: 1

Name: Action Name

Description: Required. The name of the action with a multipart response.

Parameter number: 2

Name: Index

Description: Required. The index of the part to retrieve.

Math functions

These functions can be used for either types of numbers: integers and floats.

Function name Description
add Returns the result from adding the two numbers. For example, this function returns 20.333:

add(10,10.333)

Parameter number: 1

Name: Summand 1

Description: Required. The number to add to Summand 2.

Parameter number: 2

Name: Summand 2

Description: Required. The number to add to Summand 1.

sub Returns the result from subtracting two numbers. For example, this function returns -0.333:

sub(10,10.333)

Parameter number: 1

Name: Minuend

Description: Required. The number that Subtrahend is removed from.

Parameter number: 2

Name: Subtrahend

Description: Required. The number to remove from the Minuend.

mul Returns the result from multiplying the two numbers. For example, this function returns 103.33:

mul(10,10.333)

Parameter number: 1

Name: Multiplicand 1

Description: Required. The number to multiply Multiplicand 2 with.

Parameter number: 2

Name: Multiplicand 2

Description: Required. The number to multiply Multiplicand 1 with.

div Returns the result from dividing the two numbers. For example, this function returns 1.0333:

div(10.333,10)

Parameter number: 1

Name: Dividend

Description: Required. The number to divide by the Divisor.

Parameter number: 2

Name: Divisor

Description: Required. The number to divide the Dividend by.

mod Returns the remainder after dividing the two numbers (modulo). For example, this function returns 2:

mod(10,4)

Parameter number: 1

Name: Dividend

Description: Required. The number to divide by the Divisor.

Parameter number: 2

Name: Divisor

Description: Required. The number to divide the Dividend by. After the division, the remainder is taken.

min There are two different patterns for calling this function.

Here min takes an array, and the function returns 0:

min([0,1,2])

Alternatively, this function can take a comma-separated list of values and also returns 0:

min(0,1,2)

Note: All values must be numbers, so if the parameter is an array, the array has to only have numbers.

Parameter number: 1

Name: Collection or Value

Description: Required. Either an array of values to find the minimum value, or the first value of a set.

Parameter number: 2 ... n

Name: Value n

Description: Optional. If the first parameter is a Value, then you can pass additional values and the minimum of all passed values is returned.

max There are two different patterns for calling this function.

Here max takes an array, and the function returns 2:

max([0,1,2])

Alternatively, this function can take a comma-separated list of values and also returns 2:

max(0,1,2)

Note: All values must be numbers, so if the parameter is an array, the array has to only have numbers.

Parameter number: 1

Name: Collection or Value

Description: Required. Either an array of values to find the maximum value, or the first value of a set.

Parameter number: 2 ... n

Name: Value n

Description: Optional. If the first parameter is a Value, then you can pass additional values and the maximum of all passed values is returned.

range Generates an array of integers starting from a certain number. You define the length of the returned array.

For example, this function returns [3,4,5,6]:

range(3,4)

Parameter number: 1

Name: Start index

Description: Required. The first integer in the array.

Parameter number: 2

Name: Count

Description: Required. This value is the number of integers that is in the array.

rand Generates a random integer within the specified range (inclusive only on first end). For example, this function can return either 0 or '1':

rand(0,2)

Parameter number: 1

Name: Minimum

Description: Required. The lowest integer that can be returned.

Parameter number: 2

Name: Maximum

Description: Required. This value is the next integer after the highest integer that could be returned.

Date functions

Function name Description
utcnow Returns the current timestamp as a string, for example: 2017-03-15T13:27:36Z:

utcnow()

Parameter number: 1

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

addseconds Adds an integer number of seconds to a string timestamp passed in. The number of seconds can be positive or negative. By default, the result is a string in ISO 8601 format ("o"), unless a format specifier is provided. For example: 2015-03-15T13:27:00Z:

addseconds('2015-03-15T13:27:36Z', -36)

Parameter number: 1

Name: Timestamp

Description: Required. A string that contains the time.

Parameter number: 2

Name: Seconds

Description: Required. The number of seconds to add. Can be negative to subtract seconds.

Parameter number: 3

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

addminutes Adds an integer number of minutes to a string timestamp passed in. The number of minutes can be positive or negative. By default, the result is a string in ISO 8601 format ("o"), unless a format specifier is provided. For example: 2015-03-15T14:00:36Z:

addminutes('2015-03-15T13:27:36Z', 33)

Parameter number: 1

Name: Timestamp

Description: Required. A string that contains the time.

Parameter number: 2

Name: Minutes

Description: Required. The number of minutes to add. Can be negative to subtract minutes.

Parameter number: 3

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

addhours Adds an integer number of hours to a string timestamp passed in. The number of hours can be positive or negative. By default, the result is a string in ISO 8601 format ("o"), unless a format specifier is provided. For example: 2015-03-16T01:27:36Z:

addhours('2015-03-15T13:27:36Z', 12)

Parameter number: 1

Name: Timestamp

Description: Required. A string that contains the time.

Parameter number: 2

Name: Hours

Description: Required. The number of hours to add. Can be negative to subtract hours.

Parameter number: 3

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

adddays Adds an integer number of days to a string timestamp passed in. The number of days can be positive or negative. By default, the result is a string in ISO 8601 format ("o"), unless a format specifier is provided. For example: 2015-02-23T13:27:36Z:

addseconds('2015-03-15T13:27:36Z', -20)

Parameter number: 1

Name: Timestamp

Description: Required. A string that contains the time.

Parameter number: 2

Name: Days

Description: Required. The number of days to add. Can be negative to subtract days.

Parameter number: 3

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

formatDateTime Returns a string in date format. By default, the result is a string in ISO 8601 format ("o"), unless a format specifier is provided. For example: 2015-02-23T13:27:36Z:

formatDateTime('2015-03-15T13:27:36Z', 'o')

Parameter number: 1

Name: Date

Description: Required. A string that contains the date.

Parameter number: 2

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.

startOfHour Returns the start of the hour to a string timestamp passed in. For example 2017-03-15T13:00:00Z:

startOfHour('2017-03-15T13:27:36Z')

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.

Parameter number: 2

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.
startOfDay Returns the start of the day to a string timestamp passed in. For example 2017-03-15T00:00:00Z:

startOfDay('2017-03-15T13:27:36Z')

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.

Parameter number: 2

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.
startOfMonth Returns the start of the month to a string timestamp passed in. For example 2017-03-01T00:00:00Z:

startOfMonth('2017-03-15T13:27:36Z')

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.

Parameter number: 2

Name: Format

Description: Optional. Either a single format specifier character or a custom format pattern that indicates how to format the value of this timestamp. If format is not provided, the ISO 8601 format ("o") is used.
dayOfWeek Returns the day of week component of a string timestamp. Sunday is 0, Monday is 1, and so on. For example 3:

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

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.
dayOfMonth Returns the day of month component of a string timestamp. For example 15:

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

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.
dayOfYear Returns the day of year component of a string timestamp. For example 74:

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

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.
ticks Returns the ticks property of a string timestamp. For example 1489603019:

ticks('2017-03-15T18:36:59Z')

Parameter number: 1

Name: Timestamp

Description: Required. This is a string that contains the time.

Workflow functions

These functions help you get information about the workflow itself at run time.

Function name Description
listCallbackUrl Returns a string to call to invoke the trigger or action.

Note: This function can only be used in an httpWebhook and apiConnectionWebhook, not in a manual, recurrence, http, or apiConnection.

For example, the listCallbackUrl() function returns:

https://prod-01.westus.logic.azure.com:443/workflows/1235...ABCD/triggers/manual/run?api-version=2015-08-01-preview&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=xxx...xxx

workflow This function provides you all the details for the workflow itself at the runtime.

Available properties on the workflow object are:

  • name
  • type
  • id
  • location
  • run

The value of the run property is an object with following properties:

  • name
  • type
  • id

See the Rest API for details on those properties.

For example, to get the name of the current run, use the "@workflow().run.name" expression.

Next steps

Workflow actions and triggers