Calling Power Automate from a Canvas App (And Getting Data Back)
Calling a flow from a canvas app is straightforward once you get the trigger right. Here's how to set up inputs, return data to the app, and fix the issues that come up when the two don't talk to each other.
You have a canvas app and you need it to kick off a flow — send an approval, call an external API, run a complex operation that’s easier in Power Automate. The app triggers the flow, the flow does its thing, and ideally sends a result back to the app.
Here’s how to set it up end to end.
Step 1: Create the Flow with the Right Trigger
In Power Automate, create a new Instant cloud flow and select PowerApps (V2) as the trigger.
Why V2 and not V1? The V2 trigger lets you define typed inputs (text, number, yes/no, file) with proper names. V1 uses generic “Ask in PowerApps” tokens that are harder to manage. Always use V2 for new flows.
Define Your Inputs
In the PowerApps (V2) trigger, click Add an input and choose the type:
- Text — for strings (record ID, user name, comments)
- Number — for numeric values
- Yes/No — for booleans
- File — for file content from the app
Give each input a meaningful name, like AccountId or ApprovalComment. These names will show up in the canvas app.
Step 2: Build Your Flow Logic
Add whatever actions you need between the trigger and the response. For example:
- Get a row by ID from Dataverse using the AccountId input
- Send an approval email
- Update a row with the approval result
Step 3: Return Data to the App
Add a Respond to a PowerApp or flow action at the end of your flow. This is what sends data back to the canvas app.
Click Add an output and define what you’re returning:
- Text —
ApprovalResultwith valueApproveorReject - Number —
TotalAmountwith a calculated value - Yes/No —
IsApprovedwithtrueorfalse
Important: If you don’t add this action, the flow runs but the app gets nothing back — it just fires and forgets.
Step 4: Connect the Flow to Your Canvas App
In Power Apps Studio:
- Select the button (or control) that should trigger the flow.
- Go to the Action menu in the toolbar and click Power Automate.
- Select your flow from the list. If it doesn’t appear, make sure the flow is saved and uses the PowerApps (V2) trigger.
- Power Apps adds the flow as a data source and generates a
.Run()call.
The generated formula looks like:
YourFlowName.Run(TextInput1.Text, Toggle1.Value)
The parameters match the inputs you defined in the trigger, in order.
Step 5: Use the Response in the App
Capture the flow’s response in a variable:
Set(
varFlowResult,
YourFlowName.Run(
txtAccountId.Text,
txtComment.Text
)
)
Access the returned values:
varFlowResult.approvalresult // "Approve" or "Reject"
varFlowResult.isapproved // true or false
varFlowResult.totalamount // 1500
Note: the property names are lowercase versions of your output names, with spaces removed. Approval Result becomes approvalresult.
Handling the Wait Time
When the app calls .Run(), it waits synchronously for the flow to finish. The app freezes (shows a spinner) until the response comes back. If your flow takes 30 seconds, the user waits 30 seconds.
For long-running flows:
Option 1: Remove the Respond action. The flow becomes fire-and-forget. The app doesn’t wait and doesn’t get a response. Good for flows that send emails or do background processing.
Option 2: Split into two flows. The first flow starts the process and immediately responds with a tracking ID. The second flow handles the heavy work and updates a Dataverse record. The app polls the record or the user manually refreshes.
Full Working Example
Flow: “Submit Expense for Approval”
- Trigger: PowerApps (V2) with inputs:
ExpenseId(text),Amount(number) - Action 1: Get a row by ID from Expenses table
- Action 2: Start and wait for an approval
- Action 3: Update the Expense record with the approval outcome
- Response:
IsApproved(yes/no),ApproverComment(text)
Canvas app button OnSelect:
Set(
varApprovalResult,
SubmitExpenseForApproval.Run(
Gallery1.Selected.ExpenseId,
Gallery1.Selected.Amount
)
);
If(
varApprovalResult.isapproved,
Notify("Approved! " & varApprovalResult.approvercomment, NotificationType.Success),
Notify("Rejected. " & varApprovalResult.approvercomment, NotificationType.Warning)
);
Refresh(Expenses)
V1 vs V2 Trigger Differences
| Feature | PowerApps V1 | PowerApps (V2) |
|---|---|---|
| Input definition | ”Ask in PowerApps” inline | Named, typed inputs |
| Input types | Text only (everything is a string) | Text, Number, Yes/No, File |
| Readability | Hard to tell what each input is | Clear input names |
| File support | No | Yes |
Use V2. If you have old flows on V1, they still work, but V2 is easier to maintain.
Common Mistakes and How to Fix Them
Flow Doesn’t Appear in the Power Apps Flow Panel
- The flow must use the PowerApps (V2) or PowerApps trigger. Flows with other triggers (Automated, Scheduled) won’t show up.
- The flow must be in the same environment as the app.
- The flow must be turned on and you must be an owner or co-owner of the flow.
Flow Runs But the App Gets Nothing Back
You’re missing the Respond to a PowerApp or flow action. Without it, the .Run() call returns an empty object. Add the response action and define your outputs.
”Flow returned an invalid response” Error
This happens when the flow fails mid-execution (an action errored out). The response action never runs because the flow stopped before reaching it. Add proper error handling (scope + configure run after) to ensure the response action always runs, even on failure.
Parameters Are in the Wrong Order
The .Run() call passes parameters positionally, matching the order of inputs in the trigger. If you rearrange inputs in the flow trigger, the app may send values to the wrong parameters. After changing inputs, remove the flow from the app and re-add it.
The App Times Out
The default timeout for a flow call from a canvas app is about 120 seconds. If your flow takes longer (e.g., waiting for a human approval), the app times out and shows an error. For approval flows, don’t wait for the approval inside the synchronous call — start the approval and respond immediately, then let the user check the result later.
”The operation is not valid for the current state”
This sometimes appears when the flow’s response schema doesn’t match what the app expects. Delete the flow reference from the app and re-add it. This forces the app to re-read the flow’s input/output schema.
Related articles
Power Platform Licensing: What I Wish Someone Told Me on Day One
Licensing isn't a procurement problem — it's an architecture decision. Here's the mental model every solution architect needs before starting a Power Platform project, with real scenarios and a pre-project checklist.
Power Platform Questions I See Every Week (And Their Real Answers)
A collection of the most common Power Platform developer questions — from delegation errors to Dataverse throttling — with answers that go beyond the official docs.
Low Code Isn't a Shortcut. It's a Different Trade-Off.
The debate around low-code platforms usually generates more heat than light. Here's a grounded take on when Power Platform is genuinely the right tool — and when it isn't.