knowledgecenter-breadcrum

Knowledge Center

19 Jun, 2026

How to Trigger a Power Automate Flow from Power Apps Code Apps (Latest Experience)

Posted on 19 Jun, 2026 by Rohit Bhagat, Posted in Power Apps Power Automate Power Platform

Blogs

Building a Power Apps Code App is just the beginning. In real-world business applications, users often need to send emails, create approvals, or trigger automated workflows. This is where Power Automate helps by adding automation capabilities to your application.

In this blog, we'll learn how to connect a Power Automate Flow to a Power Apps Code App and trigger it directly from React code using the latest Code Apps experience.

We'll build a simple Employee Notification application and use a Power Automate Flow to send email notifications directly from the app.

Introduction

Power Automate enables developers to automate business processes without building custom backend services. When a flow is added as a data source in a Power Apps Code App, Power Apps automatically generates the required model and service files, making it easy to invoke flows directly from React and TypeScript code.

Let's see how we can implement this in a simple Employee Notification application.

Prerequisites

Before getting started, make sure you have the following:

  • A Power Platform environment with Code Apps enabled
  • Node.js (LTS version)
  • Power Platform CLI (PAC CLI)
  • Git installed on your machine
  • Access to Power Automate

Step 1: Create a Power Apps Code App (Latest Experience)

Let's start by creating a Power Apps Code App using the latest Code Apps experience.

Run the following commands in your terminal:

  • npx degit github:microsoft/PowerAppsCodeApps/templates/vite EmployeeManagement
  • cd EmployeeManagement
  • npm install

Once the project is created, connect it to your Power Platform environment:

  • pac auth create

Select your Power Platform environment:

  • pac env select --environment {YOUR_ENVIRONMENT_ID}

Once the environment is selected, run the application locally:

  • npm run dev

Open the Local Play URL displayed in the terminal. If everything is configured correctly, you should see your Power Apps Code App running in the browser.

Deploy the Code App

After verifying that the application is working as expected, publish it to Power Apps using:

  • npm run build | pac code push

The npm run build command generates the production build, and pac code push publishes the app to Power Apps. Once deployed, the Code App becomes available in the Apps section of your environment.

Step 2: Create a Power Automate Flow

Now that our Power Apps Code App is ready, let's create a Power Automate Flow that will be triggered directly from the application.

Open your solution and click New → Automation → Cloud Flow → Instant. Provide a name for the flow and select Power Apps (V2) as the trigger.


 

Next, add the required input parameters that will be passed from the Code App. For this example, we'll create two text inputs:

  • Employee Message
  • Employee Email

Add a Send an email (V2) action and use the values received from the Power Apps trigger. Then add a Response action to return a success message back to the Code App.

Important: Make sure the flow is created inside a solution, as Power Apps Code Apps only support solution-aware flows.

Step 3: Add the Flow to Your Code App

Now that our Power Automate Flow is ready, let's add it to our Code App. First, list all available solution-aware flows in your environment:

  • npx power-apps list-flows

The command returns all available flows along with their Flow IDs.

Copy the Flow ID of the flow you want to use and run:

  • npx power-apps add-flow --flow-id { FLOW  ID}

For example:

  • npx power-apps add-flow --flow-id a2737689-ce5d-64e4-dae2-50b1a8d36822

After the flow is added successfully, Power Apps automatically generates the required files and updates the power.config.json file with the necessary flow configuration and connection references.

Step 4: Explore the Generated Files

After adding the flow successfully, Power Apps automatically generates the required TypeScript files inside the generated folder.

For our example, the following files were created: SendNotificationModel.ts and SendNotificationService.ts. The model file contains the flow input definitions, while the service file contains the methods required to execute the flow directly from the application.

  • The generated service file contains the methods required to execute the flow from your React application. Instead of writing custom API calls, we can simply use the generated service methods provided by Power Apps.
  • The generated model file contains the parameters expected by the Power Automate Flow. In our example, the flow accepts two inputs: Employee Message and Employee Email.

Step 5: Trigger the Flow from Code Apps

After adding the flow as a data source, we can trigger it directly from our React application using the generated SendNotificationService class.

In our example, we pass the employee email and employee Message to the flow using the generated Run() method:

import { SendNotificationService } from "../generated/services/SendNotificationService";

const result = await SendNotificationService.Run({
  text: employee.email,
  text_1: employee.message,
});

When the user clicks the Send Notification button, the flow executes and sends the required data to Power Automate.

Step 6: Test the End-to-End Integration

Run the application and click the Send Notification button.

When the button is clicked, the Power Automate Flow is triggered and the employee details are passed to the flow. If the flow executes successfully, a confirmation message is displayed in the application and the notification email is sent to the specified recipient.





 

Limitations and Considerations

  • Only solution-aware Power Automate flows are supported in Power Apps Code Apps.
  • The flow must use the Power Apps (V2) trigger. Other trigger types are not supported.
  • Users must have the required permissions to run the flow and access the underlying data sources.
  • If you make changes to the flow, run the add-flow command again to regenerate the latest files.
  • Flow management commands such as list-flows and add-flow are available only through the npm-based Power Apps CLI.

Conclusion

In this blog, we learned how to connect a Power Automate Flow to a Power Apps Code App and trigger it directly from React code. We also explored how Power Apps automatically generates the required files, making flow integration simple and developer-friendly.

With this approach, you can quickly add automation capabilities to your Code Apps and build powerful business solutions on the Microsoft Power Platform.

Comment

This is a Required Field

Loading

Recent Updates

How to Populate Dynamic Content Using Repeating Controls in a Word Document
Blogs
20 Jul, 2026

How to Populate Dynamic Content Using Repeating Controls in a Word Document

Introduction: Organizations frequently generate documents like invoices, certificates, quotations, transcripts, inspection reports etc. While single-value fields such as Name, Email,…

READ MORE
Blogs
15 Jul, 2026

Recovering a Deleted Option Set(Choice) Value in Dynamics 365 Using Web API

The Problem Recently, we faced an interesting issue while working with the Status Reason (statuscode) field on the Contact table.…

READ MORE
Blogs
25 Jun, 2026

Dynamics CRM Testing Checklist Before Production Deployment

There are certain things in a CRM project that a QA must validate or verify before any solutions gets deploy…

READ MORE