Output

In Azure Logic Apps, if you have a particular status or value in your Logic App workflow that you want to track for each run, you can define that within run output section and it will appear in the Management REST API for that run, and in the management UI for that run in the Azure Portal.

Outputs are not used to respond the caller service. To respond to an incoming request response, action type should be used.

The basic structure for parameters is shown here:

"outputs": { 
  "key1": { 
    "value": "value1", 
    "type" : "<type-of-value>" 
  } 
} 
  • key1: Specifies the key identifier for the output. Replace key1 with a name that you want to use to identify the output.
  • value1: Specifies the value of the output.
  • <type-of-value>: Specifies the type for the value that was specified. The possible types of values are:
    • string
    • secure string
    • int
    • bool
    • array
    • object
    • Expression, operators and functions

You can execute expressions including operators and functions within Logic Apps workflow definition language and designer view as well.

Expression

Logic Apps expression is used to evaluate a value of a specific JSON field. In Logic Apps, JSON values can either be fixed string or can be derived from the expression language. Expression can be applied anywhere within value and always evaluates a JSON field. To read more about expression, refer to the Microsoft documentation available at: https://docs.microsoft.com/en-us/rest/api/logic/definition-language.

"name": "value" 
Or  
"Email": "@parameters('Emailaddress')" 

Expressions can also appear within strings, using the string interpolation feature where expressions are wrapped within @{ ... }. See the following example:

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

String interpolation is the process of evaluating a string literal containing one or more placeholders. These placeholders are replaced by their corresponding values.

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 @, it must be escaped using @@.

Let's say I have defined myString as LogicApps and myNumber as 11.

JSON value

Result

"@parameters('myString')"

Returns LogicApps as a string.

"@{parameters('myString')}"

Returns LogicApps as a string.

"@parameters('myNumber')"

Returns 11 as a number.

"@{parameters('myNumber')}"

Returns 11 as a string.

"Count is: @{parameters('myNumber')}"

Returns the string Count is: 11.

"Count is: @@{parameters('myNumber')}"

Returns the string Count is: @{parameters('myNumber')}.

Operators

There are four operators that are the characters that you can use inside expressions/functions.

Operator

Description

. ( dot Operator)

The dot operator allows you to iterate over object properties

? (question mark)

The question mark operator allows to reference null properties of an object

' (single quotation mark)

Single quotation mark is used to wrap literal values

[] (Square bracket)

The square bracket is used to get a value from an array with a specific index

Functions

You can also call function within expressions in Logic Apps. Here is the list of few frequently used functions.

Functions

Description

@guid()

Generate a GUID

@replace(string, old, new)

Replace old with new in string

@equals(left, right)

Returns true if left equals right

@utcnow('yyyy-mm-dd')

Generate a date/time

@string()

Convert to plain/text

@json()

Convert to application/json - can parse like JSON

@xml()

Convert to application/xml

@xpath(<xml>,<expression>)

Execute Xpath expression

@if(<condition>,<true>,<false>)

Set a value based on condition

@result(<scope>)

Return the run result for a scope of actions

Note

For the detailed list of functions, please refer to the following MSDN link: https://docs.microsoft.com/en-us/rest/api/logic/definition-language#Anchor_6.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset