AZURE LOGIC APPS STANDARD / WORKFLOW DEFINITION LANGUAGE
Expression Handbook
A practical reference for transforming values, accessing workflow data, making decisions, and composing integration logic.
This catalog covers every named function in that reference, including deprecated aliases. Standard configuration expressions are covered separately. Availability of recently documented functions can depend on your installed local or hosted runtime version. This is a reference, not a Logic Apps expression execution engine.
Why Use Expressions?
Keep simple logic close to its input
Normalize a customer ID, calculate a date, or supply a default directly in an existing action field, without deploying a separate code service.
Reduce orchestration overhead
Combining small calculations can remove unnecessary Compose and variable actions. Standard is primarily capacity-based, so fewer actions do not automatically mean per-action cost savings; they can reduce execution, persistence, and operational overhead.
Build portable workflow definitions
Expressions live in workflow JSON and can be versioned and reviewed. Parameters separate environment configuration from business logic.
Handle data deliberately
Explicit conversion, null handling, URI encoding, and timestamp normalization make interfaces more predictable. Inspect action inputs and outputs in run history when available; expressions themselves are not separately traced steps.
Use the smallest understandable expression. Prefer named Compose steps, Data Operations, maps, inline code, or local functions when the logic becomes hard to review, involves large transformations, needs reusable domain rules, or requires extensive unit testing. Expressions do not perform external I/O or retrieve Key Vault secrets by themselves.
Syntax Essentials
Expression editor: enter the expression without a leading @.
toLower(trim(' PRODUCT-42 '))
Workflow code view: a whole-field expression begins with @ and preserves its native result type. Interpolation with @{...} produces text.
{
"quantity": "@int(triggerBody()?['quantity'])",
"message": "Order @{triggerBody()?['orderId']} received"
}
Strings use single quotes. Escape an apostrophe by doubling it: 'O''Brien'. In workflow JSON, escape double quotes and backslashes according to JSON rules. Use @@ to represent a literal leading @ rather than an expression.
triggerBody()?['customer']?['email']
variables('orders')[0]?['id']
coalesce(triggerBody()?['customer']?['email'], 'unknown@example.com')
The ? operator permits missing or null properties. It is not a schema validator and does not make an incorrect input type valid. Array indexes are zero-based. In signatures below, ? after an argument means optional; it is not text to paste into the designer. Arguments such as value and timestamp are placeholders.
Workflow prerequisites: examples naming an action, loop, variable, or parameter assume it exists. Use the action’s internal name, for example Get_order. Set dependencies with runAfter; simply referencing an action does not schedule it.
Literals
A literal is a value written directly in the expression. Common literal types include strings, integers, floating-point values, Boolean values, and null.
'Portugal'
42
3.14
true
null
Strings use single quotes. Escape an apostrophe by doubling it: 'O''Brien'. In workflow JSON, escape double quotes and backslashes according to JSON rules.
Function calls
A function name is followed by parentheses containing zero or more arguments. Arguments are separated by commas. Functions can receive literals or the results of other functions.
concat('INV-',
toUpper(triggerBody()?['country']), '-', string(triggerBody()?['number']))
Nesting
Nesting lets one function consume another function’s result. It is powerful, but readability decreases quickly when many operations are combined.
if(empty(triggerBody()?['customerName']),
'UNKNOWN', toUpper(trim(triggerBody()?['customerName'])))
Practical limit: If a nested expression is difficult to explain in one sentence, consider calculating important intermediate values in named Compose actions or moving complex logic into a reusable child workflow, map, script, or function.
Property access and array indexes
Object properties are addressed by name. Array items are addressed by a zero-based index. Hardcoded indexes are acceptable only when the contract guarantees the position. Otherwise, prefer a loop, Select, Filter array, query capability, or a schema that exposes the intended value directly.
triggerBody()?['customer']?['address']?['country']
body('Parse_JSON')?['orders']?[0]?['orderId']
The null-safe operator
The question mark before a property or index is a defensive navigation operator. It reduces failures caused by missing properties during navigation, but it does not solve every null problem. A later function may still reject null. Validate the value with empty(), coalesce(), or an explicit condition when the downstream function requires a concrete value.
coalesce(triggerBody()?['email'],
triggerBody()?['alternateEmail'], 'not-provided@example.invalid')
Function Catalog
No matching functions.
Standard Configuration Expressions
appsetting('SettingName') resolves an application setting in supported Standard configuration contexts, such as parameter values and connection configuration. It is not a general replacement for parameters() in workflow action expressions. Expose the setting through a workflow parameter, then use that parameter in actions.
Parameter configuration example
{
"ApiBaseUrl": {
"type": "String",
"value": "@appsetting('API_BASE_URL')"
}
}
Action URI expression, after declaring the workflow parameter
concat(parameters('ApiBaseUrl'), '/orders')
Parameterize workflows. ARM/Bicep deployment functions, Liquid template filters, JavaScript, and C# methods belong to different languages; they are not interchangeable with Workflow Definition Language functions.
Safety, Limits & Common Traps
- Null is not empty:
coalesce('', 'fallback')returns''. Combinetrim,string, andemptywhen blank text must also fall back. - Conversions can fail: malformed JSON, invalid numbers, invalid dates, out-of-bounds substring ranges, and division by zero cause runtime errors. Validate with a schema or a Condition action before unsafe operations. Do not rely on
and()oror()to short-circuit unsafe arguments. - Case handling differs:
contains()andreplace()are case-sensitive;startsWith(),endsWith(), and index-search functions are case-insensitive. - There is no general inline filter/map lambda: JavaScript syntax such as
filter(x => ...)is not WDL. Use Filter array or Select actions, or a carefully constrained XPath conversion for a single-field lookup. - XML needs structure: wrap JSON under one non-array root before
xml(). XML-to-JSON conversion can change singleton/array structure and scalar types; it is not a schema-preserving round trip. XPath uses the .NET XPath implementation, not arbitrary XPath 2.0/3.0 features. - Encoding is not encryption: Base64 and URI encoding do not protect secrets. Use managed identity and Key Vault actions where supported; secure sensitive inputs/outputs and avoid putting secrets into logs, URLs, or tracking properties.
- Binary content has metadata: many connectors supply
$contentand$content-type. Avoid double encoding and check the actual connector contract. The designer can hide implicit Base64 conversions without changing the code-view expression. - Time zones and precision matter: use Windows time-zone IDs and normalize comparisons to UTC.
div(7, 2)truncates to3;div(7, 2.0)returns3.5. Preserve important decimal precision withstring(decimal(...)). - Runtime limits still apply: expressions, payload sizes, nesting, and loops have limits.
range()has a maximum count of 100,000. Check the current limits and configuration reference before scaling. - Concurrent state and retries: avoid mutating shared variables in parallel loops. Generate a GUID or timestamp once in a named step if several actions must reuse exactly the same value. A random GUID is not a stable deduplication key across new runs.
How and where to use expressions
In the designer
- Open the trigger or action that contains the target field.
- Select the field and open the dynamic content panel.
- Choose the Expression tab.
- Enter the expression without a leading
@or@{ }. - Select Add or Update, depending on the designer experience.
- Save the workflow and test it with representative data.
- Inspect the action inputs and outputs in run history to verify the evaluated result.
In code view
In code view, the workflow JSON shows the precise persisted form. Use code view carefully because a syntax error can prevent the designer from rendering the workflow. Source control is strongly recommended for Standard projects and for deployment artifacts.
{
"inputs": {
"customerCode": "@toUpper(trim(triggerBody()?['customerCode']))",
"receivedAt": "@utcNow()",
"isPriority": "@equals(triggerBody()?['priority'], 'High')"
}
}
Common locations
- Connector and built-in action inputs
- Condition operands and trigger conditions
- Compose, Select, Filter array, and other Data Operations actions
- Variable initial values and updates
- HTTP URI, headers, query parameters, and body
- Response status, headers, and body
- Loop inputs and Until conditions
- Workflow parameters, outputs, and tracked properties
- Run-after support logic and error-handling payloads
When to use an expression
- The transformation is small, deterministic, and local to one field.
- You need to select or format a value from earlier workflow data.
- You need a simple calculation or comparison.
- You want to avoid a visual action whose only purpose is a trivial conversion.
- The expression remains understandable to the team that will support the workflow.
When not to use an expression
- The logic is long, deeply nested, or repeated in multiple workflows.
- The step needs an explicit name or must be visible in run history.
- Operations teams need to inspect the intermediate value directly.
- The logic requires independent retry, timeout, secure-input, or run-after behavior.
- The transformation is better represented by Select, Filter array, Parse JSON, a map, inline code, a child workflow, or an Azure Function.
Expressions versus workflow actions
Why expressions can be better
| Advantage | What it means in practice |
|---|---|
| Fewer visual shapes | A focused expression can avoid adding a Compose or variable action only to perform a trivial calculation. |
| Compact data shaping | The value is calculated directly where it is consumed. |
| Potentially fewer billable action executions | In Consumption workflows, replacing an unnecessary action can avoid that action execution. Validate against the current pricing model and connector type. |
| Reduced workflow noise | The designer can emphasize business orchestration rather than every small string or conversion operation. |
| Declarative and portable | Expressions are persisted in the workflow definition and can be reviewed in source control. |
| Fast for small transformations | No separate connector call or custom service is required for supported built-in functions. |
Why actions can be better
| Advantage | What it means in practice |
|---|---|
| Observability | A named action has its own inputs, outputs, status, and duration in run history. |
| Readability | A well-named Compose, Select, or Filter array action communicates intent better than a dense formula. |
| Debugging boundary | Intermediate results are easy to inspect and can isolate the failing part of the workflow. |
| Error-handling boundary | Actions can participate explicitly in run-after, scope, retry, timeout, and secure-input/output behavior. |
| Reuse inside the workflow | A Compose result can be referenced by several later actions without duplicating a complex expression. |
| Team accessibility | Visual steps may be easier for mixed developer and operations teams to understand. |
A practical decision model
| Question | If yes | If no |
|---|---|---|
| Is the logic a short one-field transformation? | Use an inline expression. | Continue the decision. |
| Will the value be reused several times? | Use a named Compose or variable when mutation is required. | Inline may be appropriate. |
| Must support teams inspect the intermediate value? | Use a visible action. | Inline may be appropriate. |
| Does it require array filtering or projection? | Prefer Filter array or Select for clarity. | Use an expression if genuinely simple. |
| Is the logic complex, recursive, or domain-heavy? | Use code, mapping, or a child workflow. | Keep it in WDL. |
| Does it need independent error handling? | Use an action boundary. | Inline may be appropriate. |
Rule of thumb: Prefer the simplest design that remains observable and maintainable. Fewer actions are not automatically better, and more visual steps are not automatically clearer.
Resume
| Expressions are strong when | Visual actions are strong when |
|---|---|
| A small calculation belongs directly in a field. | The calculation deserves an explicit business name. |
| You want fewer unnecessary visual shapes. | The intermediate result must be visible in run history. |
| A supported function avoids an external call. | The step needs separate error-handling behavior. |
| The value is used once at the point of consumption. | The value is reused by several downstream actions. |
| The formula is short and readable. | The formula becomes deeply nested or difficult to review. |
In Consumption workflows, removing a genuinely unnecessary action can also remove that action execution. Cost must still be assessed against the current pricing model, connector type, and complete design.
Advanced Scenarios
Each scenario combines several functions to reach a concrete goal. Examples are expression-editor syntax unless labeled JSON. Expected results are illustrative, not outputs captured from a live Logic Apps runtime.
01 / Read accountName Without a Filter Action
Input: the original configuration object is the trigger body. This reduced sample retains the relevant array structure.
{"properties":[
{"property":"endpoint","type":"text","value":"files.example.com"},
{"property":"accountName","type":"KeyVault","value":"common-cip-username"}
]}
xpath(
xml(addProperty(json('{}'), 'root', triggerBody())),
'string((/root/properties[property="accountName"]/value)[1])'
)
How it works: json creates an empty object, addProperty provides the required XML root, xml converts it, and xpath selects the first matching value as a string.
Result: common-cip-username. No match produces an empty string. Duplicate names select the first value. The lookup is case-sensitive and returns a secret name, not a secret. A Key Vault action is still needed to resolve it. Use fixed or allowlisted property names; do not concatenate untrusted text into an XPath predicate.
02 / Normalize an Optional Customer Email
Input: {"customer":{"email":" Alice@Example.com "}}. Place this in a Compose action named Normalized_email.
toLower(trim(string(coalesce(triggerBody()?['customer']?['email'], ''))))
Use a second expression for missing or whitespace-only text
if(empty(outputs('Normalized_email')), 'unknown@example.com', outputs('Normalized_email'))
Result: alice@example.com, or the fallback. This normalizes text; it does not validate email syntax. Two named steps prevent repeated normalization and keep the rule readable.
03 / Build a Product Export Filename
Prerequisites: filenamePrefix is a string parameter containing pdtOut_0M_SG_. Compose Export_time once with utcNow() if the name is reused.
concat(
parameters('filenamePrefix'),
formatDateTime(outputs('Export_time'), 'yyyyMMdd_HHmmss'),
'_', workflow()?['run']?['name'], '.csv'
)
Result pattern: pdtOut_0M_SG_20261012_113000_RUN-ID.csv. The prefix, formatted time, and run identifier avoid same-second collisions across runs. Validate the prefix against the target filesystem’s naming rules; use a source business identifier if the name must remain stable across replayed runs.
04 / Build a Safely Encoded Search URL
Prerequisites: ApiBaseUrl is https://api.example.com without a trailing slash. Trigger body contains {"query":"red & blue"}.
concat(
parameters('ApiBaseUrl'), '/products?q=',
uriComponent(trim(string(coalesce(triggerBody()?['query'], ''))))
)
Result: https://api.example.com/products?q=red%20%26%20blue. Encode the query value, not the complete URL. This constructs text only; an HTTP action performs the request.
05 / Deduplicate, Sort, and Page IDs
Prerequisites: ids is an array variable containing [5,2,5,1,4], pageIndex is integer 1, and pageSize is positive integer 2.
take(
skip(sort(union(variables('ids'), variables('ids'))),
mul(variables('pageIndex'), variables('pageSize'))),
variables('pageSize')
)
Result: [4,5]. Union removes identical primitive values, sort establishes order, skip applies a zero-based page offset, and take limits the page. Validate the paging variables first. Object deduplication is by complete value, not by an object’s ID field; server-side paging is preferable for large datasets.
06 / Route a High-Value Order
Input: schema-validated {"amount":1250,"country":" pt "}. The amount is already numeric.
if(
and(
greaterOrEquals(triggerBody()?['amount'], 1000),
contains(createArray('PT', 'ES'), toUpper(trim(triggerBody()?['country'])))
),
'priority', 'standard'
)
Result: priority. Compare the number and normalize the country before set membership. The expression produces a routing label; use a Switch or Condition action to execute the selected branch.
07 / Calculate UTC Elapsed Minutes
Prerequisites: startedAt is a validated ISO UTC timestamp. Compose Evaluation_time once with utcNow().
div(
sub(ticks(outputs('Evaluation_time')), ticks(triggerBody()?['startedAt'])),
600000000
)
Result: with start 2026-10-12T10:00:00Z and evaluation 2026-10-12T11:30:00Z, the result is 90. There are 600,000,000 ticks per minute. Integer division gives whole minutes. Use 600000000.0 for fractional minutes; a future start produces a negative interval.
08 / Enrich a Payload Without String-Building JSON
Input: a JSON object containing {"orderId":"A42","internalNote":"private"}.
setProperty(
setProperty(removeProperty(triggerBody(), 'internalNote'),
'correlationId', workflow()?['run']?['name']),
'processedAt', utcNow()
)
Result: an object retaining orderId, removing internalNote, and adding correlationId and processedAt. Object functions escape strings correctly and preserve types. Removal is top-level only; this is not comprehensive redaction of nested secrets.
09 / Decode and Read a Base64 JSON Message
Input: {"content":"eyJvcmRlcklkIjoiQTQyIn0="}. The producer contract guarantees Base64-encoded UTF-8 JSON.
coalesce(
json(base64ToString(triggerBody()?['content']))?['orderId'],
'missing-order-id'
)
Result: A42. Decode the text, parse JSON, and supply a default only for a missing/null ID. Invalid Base64 or JSON still fails; handle that action failure through a Scope and runAfter. On runtimes supporting it, base64ToJson() combines decoding and parsing.
10 / Create a Bounded Backoff Interval
Prerequisite: attempt is a validated nonnegative integer variable, capped at 10. Use the result as the seconds count in a Delay action in a custom retry loop.
add(
min(300, mul(5, pow(2, variables('attempt')))),
rand(0, 5)
)
Result: attempt 3 gives 40 to 44 seconds. The base delay is capped at 300 seconds; jitter can add up to 4, so the overall maximum is 304. Compute it once per attempt if reused. Prefer the action’s built-in retry policy where supported; avoid layering two retry mechanisms or retrying non-idempotent operations without protection.