web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to trigger Power A...
Power Apps
Answered

How to trigger Power Automate Flow from a Power Apps "Code App"

(2) ShareShare
ReportReport
Posted on by 6
Hi, 
 
what is the best approach to trigger a Power Automate Flow from a Power Apps "Code App"? 
 
 
Thank you!
Christian
Categories:
I have the same question (0)
  • Verified answer
    whitebeard Profile Picture
    135 on at

    Hi @CU31121115-0,

    The best and most verified approaches to trigger a Power Automate flow from a Code App are listed below.

    1. HTTP Request (Best for Decoupled Execution)
    The most reliable method for a code-first application to trigger a specific flow is to use the When an HTTP request is received trigger in Power Automate. This creates a REST API endpoint that your Code App can call using standard JavaScript fetch or XMLHttpRequest. Best approach if it's a standalone web application (hosted separately).

    How it works: 

    1. Create a generic Instant Cloud Flow.
    2. Select the When an HTTP request is received trigger with use "Anyone" can trigger.
    3. Define a JSON Schema for the data your Code App will send.
    4. Copy the generated HTTP POST URL after saving the flow.
    5. In your Code App, use a standard fetch call to POST data to that URL.
    • Pros: Instant execution; allows passing complex JSON data; standard web development pattern.

    • Cons: The URL acts as a public endpoint (unless secured with complex OAuth headers); requires managing the URL in your code config.

    2. Dataverse Web API / Custom Action (Best for Security & Integration)
    Since the Code App SDK is explicitly designed to Connect to Dataverse, the most "native" approach is to trigger the flow indirectly via a Dataverse event. This is the best approach if your app runs inside the Power Platform host, as it reuses the authenticated user session.

    • Option A: Custom API (Unbound Action)

    1. Create a Custom API (Action) in Dataverse.
    2. Create a Flow that triggers When an action is performed (Dataverse connector).
    3. From your Code App, use the verified Dataverse client (or fetch with the platform auth token) to call this action.
     
    Note: This keeps the request within the authenticated user's session without exposing public HTTP endpoints.
     

    Hope this helps!

  • Suggested answer
    CU24031735-0 Profile Picture
    2 on at
    I tried the above suggestion but hitting the authentication issues with both the approaches. Below is a more appropriate solution to trigger a power automate flow from a code app.
     
    How to Trigger Power Automate from Code Apps
    1. Create a Power Automate Flow — Add the "When an HTTP request is received" trigger, define the input parameters and the expected output response schema. Once saved, the flow will generate an HTTP endpoint.

    2. Create a Custom Connector — Since Code Apps cannot directly pass an authentication token to validate requests against the HTTP endpoint, a Custom Connector is required. Configure the custom connector to point to the generated HTTP endpoint with the necessary authentication setup.

    3. Add as a Data Source in Code Apps — Add the custom connector as a data source within your Code App.

    4. Trigger the Flow — Call the custom connector action from your Code App, which internally triggers the Power Automate flow via the HTTP endpoint.
     
    Created a detailed article on the steps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 577

#2
WarrenBelz Profile Picture

WarrenBelz 440 Most Valuable Professional

#3
Haque Profile Picture

Haque 308

Last 30 days Overall leaderboard