Power automate expression syntax
Write, validate, and debug Microsoft Power Automate expressions. Use for Workflow Definition Language expressions in cloud flows, dynamic content, runAfter conditions, null-safe property access, variables, trigger/action outputs, date/string/array functions, and for deciding when Power Fx applies only to desktop-flow or other Power Platform formula surfaces.
ByWals.pro teamPower Platform consultancy @ Wals.pro- name:
- power-automate-expression-syntax
- description:
- Write, validate, and debug Microsoft Power Automate expressions. Use for Workflow Definition Language expressions in cloud flows, dynamic content, runAfter conditions, null-safe property access, variables, trigger/action outputs, date/string/array functions, and for deciding when Power Fx applies only to desktop-flow or other Power Platform formula surfaces.
Power Automate Expression Syntax
Power Automate cloud flows use Workflow Definition Language expressions. Power Fx is a separate formula language and is not the default for cloud-flow JSON.
Workflow
- Identify the expression host:
- Cloud-flow action/condition/JSON: WDL expressions.
- Desktop flow formula mode: Power Fx.
- For cloud-flow expressions, read
references/cloud-flow-expressions.md. - For desktop-flow Power Fx, read
references/power-fx-desktop-flows.md. - Validate against live run inputs where possible; expression errors are often data-shape errors rather than syntax-only errors.
Cloud-Flow Guardrails
- Use
@{...}inside string interpolation and@...when the whole value is an expression. - Prefer null-safe access with
?[]for optional action outputs. - Use exact action names in
outputs('Action_Name'),body('Action_Name'), andactions('Action_Name'). - Avoid copying expressions from rendered docs without checking quotes and invisible characters.
- Confirm a function exists in
power-automate-reference(the complete WDL namespace) before using it — the namespace is closed; do not invent functions.
Open this reference as its own page
Cloud-Flow Expressions
Official references:
- Expression cookbook: https://learn.microsoft.com/en-us/power-automate/expression-cookbook
- Use expressions in conditions: https://learn.microsoft.com/en-us/power-automate/use-expressions-in-conditions
- Full Workflow Definition Language function reference: https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference
Syntax Forms
- Whole value expression:
@variables('name') - String interpolation:
Hello @{triggerBody()?['name']} - Action body:
@body('Get_item') - Trigger body:
@triggerBody() - Action output:
@outputs('Get_item') - Variable:
@variables('CertificateAttachments') - Parameter:
@parameters('Parameter Name')
Common Function Groups
- Text:
concat,replace,split,substring,toLower,toUpper,trim - Dates:
utcNow,formatDateTime,addDays,ticks,convertTimeZone - Arrays:
first,last,length,join,union,intersection - Objects/JSON:
json,coalesce,addProperty,setProperty,removeProperty - Logic:
if,and,or,not,equals,greater,less - Workflow:
body,outputs,triggerBody,triggerOutputs,workflow
Safe Data Access
Use null-safe operators when source actions can fail, return empty results, or skip a branch:
@body('Get_item')?['Title']
@outputs('Get_file_content')?['body']
@first(body('List_rows')?['value'])?['name']
Use coalesce() for fallback values:
@coalesce(body('Get_item')?['Title'], 'Unbenannt')
Common Failure Modes
InvalidTemplate: syntax error, missing action name, wrong argument count, or constant expression that fails during save.ExpressionEvaluationFailed: runtime data did not match the expression, such as null property access, invalid date format, or numeric conversion failure.- Wrong action name: cloud-flow JSON uses internal action keys, not always the display text seen in the designer.
- Attachments and binary content: verify whether the connector expects raw
bytes, base64 text, or an object with
$content.
Review Checklist
- Does the expression host expect a full expression or string interpolation?
- Are action names exact and stable in JSON?
- Are optional values null-safe?
- Are arrays handled for empty results?
- Are date/time values formatted explicitly?
- Is binary content attached in the connector's expected shape?
Open this reference as its own page
Power Fx for Desktop Flows
Official references:
- Power Fx formula reference overview: https://learn.microsoft.com/en-us/power-platform/power-fx/formula-reference-cards
- Power Fx in desktop flows: https://learn.microsoft.com/en-us/power-automate/desktop-flows/power-fx
Scope
Use Power Fx references only when the target is a Power Fx-enabled host, such
as Power Automate desktop-flow formula mode. Do not use Power Fx syntax for
cloud-flow JSON actions, conditions, or clientdata expressions.
Practical Differences From Cloud-Flow Expressions
- Power Fx has Excel-like formulas and typed values.
- Cloud flows use WDL functions such as
body(),outputs(),variables(), andtriggerBody(). - A function being available in Power Fx does not imply it is valid in a cloud-flow expression.
Desktop-Flow Checklist
- Confirm the desktop-flow action supports Power Fx mode.
- Check each formula reference article's "Applies to" section.
- Watch for functions that exist in Power Fx generally but are not available in desktop flows.
- Validate in the desktop-flow designer when the reference says support is partial or host-specific.
More in this playbook
Safe to turn on
Use this skill when an agent or person is about to create, change or enable an automation inside someone else's account or a shared environment: "create this workflow", "build it in the customer's account", "turn it on", "go live", "deploy this automation". Produces a proposal the human approves, an automation created in the off state, and a short list of what only the human can finish.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.


