Most Canvas Apps stop at data entry — this lesson shows you how to close the loop by triggering real, formatted Outlook emails from button controls. You'll build a complete Power Automate integration that accepts dynamic form data as parameters and returns structured responses your app can act on.

Picture this: your team has built a slick expense approval form in Power Apps. A manager reviews a submitted expense report, clicks "Approve," and... nothing happens. The submitter has no idea their request was processed. Someone has to manually open Outlook, copy the employee's email address, paste in a summary of the approval, and hit send. Every. Single. Time.
This is the gap that Canvas App email integration fills. The ability to trigger a contextual, data-rich email directly from a button press — without leaving the app, without manual copy-pasting, and without requiring users to have anything open except Power Apps — is one of the most valuable automation patterns you can build. And it's more nuanced than it looks. You're not just wiring up a "send email" action; you're designing a flow that accepts dynamic data from a live form, constructs a meaningful message from it, and handles errors gracefully when the email fails to send.
By the end of this lesson, you'll have built a working email integration from scratch. You'll understand why Power Automate is the right bridge for this job, how to design a flow that accepts named parameters from Power Apps, how to pass live form values through that interface, and how to give your users meaningful feedback at every step of the process.
What you'll learn:
OnSelect formula to call the flow and pass dynamic form dataYou should already be comfortable with the basics of Canvas App construction. If you've worked through building your first Canvas App in Power Apps or tackled the 30-minute data entry form lesson, you're in good shape. You'll also want a working understanding of Power Apps formulas — particularly Patch, If, and Set — which are covered in depth in the Power Apps formulas guide.
You'll need:
Before you write a single formula, you need to understand what's actually happening under the hood. This is the piece most tutorials skip, and it's why so many implementations break in unpredictable ways.
When a button in a Canvas App triggers an email, the sequence looks like this:
OnSelect formula calls a Power Automate flow using the .Run() methodThe critical insight here is that Power Apps cannot call the Outlook connector directly. The Office 365 Outlook connector does exist in Power Apps, and you can technically use it to send emails from formulas — but this approach has serious limitations. It runs synchronously, blocking the app UI during the send operation. It exposes the connector credentials directly in the app. And it gives you almost no control over error handling or logging.
Power Automate, by contrast, runs asynchronously in the cloud, gives you a full workflow engine for error handling, retry logic, and conditional logic, and returns a clean response to the app when it's done. This is the production-grade approach.
Key insight
The .Run() method in Power Apps is synchronous from the app's perspective — your formula waits for the flow to respond before continuing. But the flow itself runs in Power Automate's cloud infrastructure. This means the email is sent from Power Automate's connection context, not the user's device, which is important for auditing and permissions.
We're going to build a realistic example: an expense approval screen. A manager sees a list of pending expenses, selects one, and clicks "Approve" or "Reject." The appropriate party — either the submitter or the finance team — receives a formatted email with the relevant details.
This scenario is real. It involves multiple recipients, conditional routing, and dynamic data that includes employee names, amounts, dates, and manager comments. It's the right level of complexity to teach you everything you need to know.
Our form will collect or display the following fields:
If you're connecting to SharePoint or Dataverse as your data source, the complete integration guide covers that setup. For this lesson, we'll use a Collection pre-populated with sample data so you can focus on the email integration.
On your app's first screen, add a Gallery to display pending expenses. Set its Items property to a collection called PendingExpenses. On your approval screen, add the following controls:
lblSubmitterName — set its Text to Gallery1.Selected.SubmitterNamelblSubmitterEmail — set its Text to Gallery1.Selected.SubmitterEmaillblAmount — set its Text to Text(Gallery1.Selected.Amount, "[$-en-US]$ #,##0.00")lblDescription — set its Text to Gallery1.Selected.DescriptiontxtManagerComment — this is where the manager types their notebtnApprove (green, labeled "Approve") and btnReject (red, labeled "Reject")You'll also want a Label named lblStatus that starts with empty text — this is where we'll display success or error feedback to the user.
Tip
Keep your form controls' Default or Text properties tied to gallery selection rather than variables whenever the data is read-only display. This keeps your formula layer clean. Reserve variables for things the user is actively changing or that represent app state, like the manager comment and the send result.
Open Power Automate at flow.microsoft.com (or use the Power Automate panel inside Power Apps Studio). Create a new Instant cloud flow and select Power Apps as the trigger. Name it something descriptive: PA_ExpenseApproval_SendNotification.
This is where most people make their first mistake. The Power Apps trigger in Power Automate doesn't automatically know what data it'll receive — you have to define the inputs explicitly. In the trigger step, click "+ Add an input" and add the following:
| Input Name | Type |
|---|---|
| SubmitterName | Text |
| SubmitterEmail | Text |
| ExpenseAmount | Text |
| ExpenseDescription | Text |
| ManagerComment | Text |
| Decision | Text |
| ManagerName | Text |
Notice that ExpenseAmount is defined as Text even though it's a currency value in the app. This is intentional. Power Apps can only pass primitive types through the flow trigger, and passing numbers as text gives you more flexibility in formatting them inside the email body. You'll convert or format them in the email template.
Warning
Don't try to pass complex objects, tables, or records directly through the Power Apps trigger. The trigger only accepts Text, Number, Boolean, and File inputs. If you need to pass structured data, serialize it as a JSON string using the JSON() function in Power Apps, then parse it inside the flow with the Parse JSON action — but for most email scenarios, individual named parameters are cleaner and more maintainable.
Before the Send Email action, add a Compose action. Set its Inputs to the following expression — this builds your HTML email body:
<html>
<body style="font-family: Segoe UI, sans-serif; color: #333;">
<h2 style="color: @{if(equals(triggerBody()['text_4'], 'Approve'), '#107C10', '#D83B01')}">
Expense @{triggerBody()['text_4']}d
</h2>
<p>Hello @{triggerBody()['text']},</p>
<p>Your expense request has been reviewed by <strong>@{triggerBody()['text_7']}</strong>.</p>
<table style="border-collapse: collapse; width: 100%;">
<tr>
<td style="padding: 8px; border: 1px solid #ddd; background: #f8f8f8;"><strong>Description</strong></td>
<td style="padding: 8px; border: 1px solid #ddd;">@{triggerBody()['text_4_1']}</td>
</tr>
<tr>
<td style="padding: 8px; border: 1px solid #ddd; background: #f8f8f8;"><strong>Amount</strong></td>
<td style="padding: 8px; border: 1px solid #ddd;">$@{triggerBody()['text_3']}</td>
</tr>
<tr>
<td style="padding: 8px; border: 1px solid #ddd; background: #f8f8f8;"><strong>Decision</strong></td>
<td style="padding: 8px; border: 1px solid #ddd;">@{triggerBody()['text_4']}</td>
</tr>
<tr>
<td style="padding: 8px; border: 1px solid #ddd; background: #f8f8f8;"><strong>Manager Comment</strong></td>
<td style="padding: 8px; border: 1px solid #ddd;">@{triggerBody()['text_5']}</td>
</tr>
</table>
<p style="margin-top: 20px; color: #666; font-size: 12px;">This email was sent automatically from the Expense Management App.</p>
</body>
</html>
The trigger body references (triggerBody()['text'], triggerBody()['text_3'], etc.) are Power Automate's internal names for your inputs. They're assigned in order of creation, which is why naming matters during setup. After saving the flow once, you can switch to using the friendly dynamic content labels from the Power Apps trigger step, which are much more readable.
Tip
Use the Compose action to build your HTML body separately from the Send Email step. This makes debugging significantly easier — you can see the rendered output in the flow run history without having to open the email itself.
Add the Office 365 Outlook: Send an email (V2) action. Configure it as follows:
SubmitterEmail from your triggerconcat('Expense ', triggerBody()['text_4'], ': ', triggerBody()['text_4_1'])
This produces something like: Expense Approved: Team Offsite CateringIs HTML to Yes, then reference the output of your Compose actionAdd a Respond to a PowerApp or flow action at the end. This is what allows your Canvas App to know the flow completed successfully. Add one output:
| Output Name | Type | Value |
|---|---|---|
| EmailStatus | Text | success |
You can also add a conditional branch before this step: if the Send Email action fails, use Configure run after to catch the failure path and return EmailStatus = failed with an error message. This is proper error handling — and it's what separates a production integration from a demo.
Go back to Power Apps Studio. Select your btnApprove button and click on its OnSelect property. This is where the magic happens.
First, you need to add the flow to your app. In the left panel, navigate to Data > Power Automate and click "Add flow." Find your PA_ExpenseApproval_SendNotification flow and add it. Power Apps will now recognize the .Run() method on this flow.
Here's the complete OnSelect formula for btnApprove:
// Set loading state
Set(varIsSending, true);
Set(varStatusMessage, "");
// Call the flow with dynamic form data
Set(
varFlowResponse,
PA_ExpenseApproval_SendNotification.Run(
lblSubmitterName.Text,
lblSubmitterEmail.Text,
lblAmount.Text,
lblDescription.Text,
txtManagerComment.Text,
"Approve",
User().FullName
)
);
// Handle the response
If(
varFlowResponse.emailstatus = "success",
Set(varStatusMessage, "✓ Approval email sent to " & lblSubmitterName.Text);
Notify("Email sent successfully.", NotificationType.Success),
Set(varStatusMessage, "⚠ Email failed to send. Please try again.");
Notify("There was a problem sending the email.", NotificationType.Error)
);
// Clear loading state
Set(varIsSending, false)
For btnReject, copy the same formula but change "Approve" to "Reject" and update the status message text accordingly.
Notice the structure here. We're using Set() to manage three pieces of state:
varIsSending — a boolean that drives a loading indicatorvarStatusMessage — a string displayed in lblStatusvarFlowResponse — the response object from the flowYou might be wondering about Power Apps variables — specifically whether global variables (Set) or context variables (UpdateContext) are more appropriate here. Because the approval action and status display are on the same screen, context variables would work, but global variables are fine here too since varIsSending might be referenced by multiple controls across the screen (button disabled state, loading spinner visibility, etc.).
Key insight
The .Run() method parameters must be passed in exactly the same order you defined the inputs in the Power Automate trigger. Power Apps doesn't use named argument syntax here — it's positional. If you add or reorder inputs in the flow, you must update every .Run() call in the app.
Now wire your controls to the state variables:
btnApprove and btnReject — DisplayMode property:
If(varIsSending, DisplayMode.Disabled, DisplayMode.Edit)
lblStatus — Text property:
varStatusMessage
lblStatus — Color property:
If(
StartsWith(varStatusMessage, "✓"),
RGBA(16, 124, 16, 1),
If(
StartsWith(varStatusMessage, "⚠"),
RGBA(216, 59, 1, 1),
RGBA(0, 0, 0, 1)
)
)
This turns the status label green for success and orange-red for errors — a small detail that makes a big difference in user experience.
Calling the flow with empty or invalid data wastes an API call and can produce confusing emails. Add validation logic before the .Run() call. Here's a more complete version of the OnSelect formula with validation built in:
// Validate required fields
If(
IsBlank(txtManagerComment.Text),
Notify(
"Please add a comment before approving.",
NotificationType.Warning
),
// All validation passed — proceed
Set(varIsSending, true);
Set(varStatusMessage, "");
Set(
varFlowResponse,
PA_ExpenseApproval_SendNotification.Run(
lblSubmitterName.Text,
lblSubmitterEmail.Text,
lblAmount.Text,
lblDescription.Text,
txtManagerComment.Text,
"Approve",
User().FullName
)
);
If(
varFlowResponse.emailstatus = "success",
Set(varStatusMessage, "✓ Approval email sent to " & lblSubmitterName.Text);
// Optionally update the SharePoint record status
Patch(
PendingExpenses,
Gallery1.Selected,
{
Status: "Approved",
ApprovedBy: User().FullName,
ApprovedDate: Today()
}
),
Set(varStatusMessage, "⚠ Email failed to send. Please try again.")
);
Set(varIsSending, false)
)
Notice that on success, we also call Patch() to update the record status in our data source. This is the correct pattern — the email notification and the data update should be treated as two separate actions, both triggered by the same button press. If you need a refresher on building reliable form patterns with validation, the data validation guide covers IsBlank, IsMatch, and multi-field validation logic in detail.
Real approval workflows rarely send to a single recipient. You often need to CC the finance team, BCC an audit mailbox, or send to a distribution list conditionally. Here's how to handle this without complicating the Power Apps formula.
Add additional input parameters to your flow trigger:
| Input Name | Type | Purpose |
|---|---|---|
| CCEmail | Text | Finance team address |
| ExpenseCategory | Text | Drives conditional routing |
In the flow, add a Condition action after the trigger:
ExpenseCategory is equal to TravelIn Power Apps, your .Run() call becomes:
Set(
varFlowResponse,
PA_ExpenseApproval_SendNotification.Run(
lblSubmitterName.Text,
lblSubmitterEmail.Text,
lblAmount.Text,
lblDescription.Text,
txtManagerComment.Text,
"Approve",
User().FullName,
"finance@contoso.com",
lblCategory.Text
)
)
The conditional routing logic lives entirely in the flow, which is exactly where it belongs. Your Canvas App stays simple — it just passes data. The flow makes decisions about what to do with it.
Note
You can pass a semicolon-delimited string of email addresses to the To field in Office 365 Outlook's Send Email action. For example: "alice@contoso.com;bob@contoso.com". This is useful when you need to notify multiple people but want to keep the Power Apps formula clean. Build the concatenated string in Power Apps before passing it to the flow.
The Respond to a PowerApp or flow action only fires on the happy path unless you explicitly configure the failure path. Here's how to build a robust error-handling structure.
In your flow, after the Send Email action, add a Control: Scope action. Name it Scope_SendEmail and move the Send Email action inside it.
Then, after the scope, add two Respond to a PowerApp or flow actions:
On success: Configure Run after so this step runs only when Scope_SendEmail succeeds. Return EmailStatus = success.
On failure: Configure Run after so this step runs when Scope_SendEmail has failed or timed out. Return EmailStatus = failed and an additional output ErrorMessage with the expression:
result('Scope_SendEmail')?['error']?['message']
Back in Power Apps, your formula can then expose the error message to users or log it:
If(
varFlowResponse.emailstatus = "success",
Set(varStatusMessage, "✓ Approval email sent to " & lblSubmitterName.Text),
// On failure
Set(
varStatusMessage,
"⚠ Email failed: " & varFlowResponse.errormessage
);
// Log the failure to a SharePoint list for ops review
Patch(
EmailErrorLog,
Defaults(EmailErrorLog),
{
Timestamp: Now(),
User: User().Email,
ErrorDetail: varFlowResponse.errormessage,
RecordID: Text(Gallery1.Selected.ID)
}
)
)
This is a genuinely production-grade pattern — you're surfacing error details to the user and writing them to an audit log for your operations team. For deeper patterns around error handling in Canvas Apps, the IfError, Notify, and graceful failure patterns article is worth a read alongside this lesson.
Build the full expense approval integration from scratch. Here are your requirements:
Setup:
PendingExpenses with at least three sample records containing fields: SubmitterName, SubmitterEmail, Amount, Description, Category, and Status.Flow:
3. Create a Power Automate instant flow triggered by Power Apps with the following inputs: SubmitterName, SubmitterEmail, ExpenseAmount, ExpenseDescription, ManagerComment, Decision, ManagerName.
4. Build an HTML email body in a Compose step that uses conditional formatting — green header for approvals, red for rejections.
5. Send the email and return EmailStatus = success or failed.
Canvas App:
6. On the approval screen, add a text input for the manager comment.
7. Add both Approve and Reject buttons.
8. The OnSelect of each button should:
txtManagerComment is not blankStatus field to "Approved" or "Rejected" using Patch().Stretch goal:
10. Add a CC input to the flow. If the expense amount (passed as text, converted with Value() inside the flow) is greater than $1,000, CC the CFO's email address automatically using a Condition action in the flow.
This almost always means parameter order mismatch. The .Run() method is positional. Open your flow trigger and count the inputs in order. Count the arguments in your .Run() call. They must match exactly. If you deleted and re-added an input in the flow, its position may have changed.
The Respond to a PowerApp or flow action's output properties are accessed in Power Apps using all-lowercase names, regardless of how you named them in the flow. If your output is named EmailStatus, reference it as varFlowResponse.emailstatus in Power Apps formulas. This is a known quirk that trips up nearly everyone the first time.
If the flow completes and sends the email but Power Apps shows an error, check whether the Respond to a PowerApp or flow action is timing out. By default, Power Apps waits for the flow to respond for up to 90 seconds. If your flow has retry logic or long-running steps, it may exceed this. Keep the core send-and-respond path short, and move heavy processing to separate flows triggered asynchronously.
Warning
Never put a delay or approval step (like a human approval action) between the Power Apps trigger and the Respond action. These will cause the Power Apps formula to time out. If you need a human approval step, that should be a separate flow triggered by a Dataverse or SharePoint record change — not inline with the Power Apps call.
Check the connection context. When you test a flow, it runs under your credentials. In production, it runs under whoever's connection is saved on the flow. If you share the app but not the flow's connections, users will get authentication errors. Either share the flow connection explicitly or use a service account connection. The app security and sharing guide covers connection sharing in detail.
Make sure the Is HTML toggle is set to Yes in the Office 365 Outlook Send Email action. This is easy to miss because it's not prominently visible in the collapsed action view — you have to expand the advanced options.
When something goes wrong, use Power Automate's run history to inspect exactly what values arrived at the trigger. Navigate to your flow, click 28 day run history, and open the failed run. You can expand each action and see the inputs and outputs. This is far more reliable than adding diagnostic Notify calls throughout your app.
Tip
For Canvas App-side debugging, the Power Apps Monitor tool lets you watch the .Run() call in real time. You'll see the network request going out and the response coming back, including the full JSON payload. This is the fastest way to verify that your app is sending the right parameter values to the flow.
You've built a full end-to-end email integration: a Canvas App form that collects and validates data, a Power Automate flow that accepts named parameters, constructs a formatted HTML email, sends it via Outlook, and returns a typed response — and an app that handles both success and failure states with real user feedback.
The pattern you've learned here — Canvas App calls flow, flow does work, flow responds, app reacts — generalizes to far more than email. You can use the same architecture to trigger Teams messages, create PDF documents, write records to external systems via API, or kick off multi-step approval chains. Once you understand the channel (.Run() → trigger inputs → response outputs), you can connect Power Apps to almost anything.
Where to go next:
The notification layer is often what transforms a data entry tool into a workflow product. You've now got the foundation to build it right.
Canvas Apps 101