Triggering flows from portal forms

Loading

Power Pages (formerly Power Apps Portals) allows you to build secure, data-driven websites that can interact with Microsoft Dataverse and external systems. One of the most powerful ways to extend its capabilities is by triggering Power Automate flows when a user submits a form. This integration automates workflows such as sending emails, processing approvals, updating other systems, and more.

This detailed guide explains how to trigger flows from portal forms step by step.


Why Trigger Flows from Portal Forms?

Triggering flows on form submissions helps you:

  • Send real-time notifications to stakeholders
  • Update or sync data in external systems
  • Perform background calculations or processes
  • Log form activity for audit or analytics
  • Start approval workflows

Available Trigger Options

There are three primary ways to trigger a Power Automate flow from a portal form:

  1. When a Dataverse record is created or modified
  2. Using JavaScript to call a flow via HTTP
  3. Using Webhooks or Custom APIs (advanced)

Approach 1: Triggering via Dataverse (Most Common)

Use Case: You have a form that creates or updates a Dataverse record (via Entity/Form in Power Pages)

Step-by-Step:

1. Create the Portal Form

  • Go to Power Pages Studio
  • Add an Entity Form (now called Basic Form) tied to a Dataverse table
  • Set it to create or update mode

Example: A Contact Us form that saves data in a Contact Requests table


2. Create a Power Automate Flow

  • Open Power Automate (https://make.powerautomate.com)
  • Create a new Automated Cloud Flow
  • Trigger: When a row is added, modified, or deleted (Dataverse)
  • Choose:
    • Change Type: Create
    • Table: Contact Requests (or your custom table)
    • Scope: Organization

3. Add Actions in the Flow

  • Use Get row by ID if you need more data
  • Send email, update records, call APIs, etc.
Example:
- Get row details
- Send a confirmation email to user
- Notify admin team in Teams

4. Save and Test

  • Submit the form on the portal
  • Verify that the flow gets triggered and performs expected actions

Pros:

  • Secure (no direct API tokens)
  • Easy to manage in low-code
  • Works automatically with table-bound forms

Approach 2: Triggering Flow from Portal via HTTP Request (JavaScript)

Best for custom logic or unbound forms where you want to manually call a Power Automate flow.

Step-by-Step:

1. Create a Power Automate Flow with HTTP Trigger

  • Trigger: When an HTTP request is received
  • Design your logic
  • End with a Response action to return data to the portal
{
"firstName": "string",
"email": "string",
"message": "string"
}

2. Copy the HTTP POST URL

  • Save and copy the automatically generated endpoint

3. Add JavaScript in Your Web Page or Web Template

<script>
function submitToFlow() {
const payload = {
firstName: document.getElementById("fname").value,
email: document.getElementById("email").value,
message: document.getElementById("msg").value
};

fetch("https://prod-00.westus.logic.azure.com:443/workflows/...", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => {
alert("Submitted successfully!");
})
.catch(err => {
console.error("Flow error:", err);
});
}
</script>

Add the above function call to your custom form’s submit button.


4. Secure the Flow

  • Restrict access using Azure API Management or a Gateway
  • Or add an API key header for authentication

Avoid putting secrets in frontend JS


Approach 3: Using Webhooks or Custom APIs (Advanced)

Advanced scenarios might require:

  • Custom Dataverse plugins that invoke flows or APIs
  • Azure Functions triggered from Power Pages
  • Custom web services that are called from Power Automate and handle more logic

Best Practices

PracticeRecommendation
SecurityNever expose secrets in frontend code
ValidationValidate form inputs before sending to Flow
Error HandlingAdd try/catch logic in Flow and frontend
TestingAlways test with sample data and debug responses
LoggingLog submissions in Dataverse or use telemetry

Common Use Cases

  • Contact or inquiry forms that notify sales team
  • Feedback forms that create a case record
  • Job application forms that start HR workflows
  • Custom forms that interact with SharePoint, Outlook, Teams, etc.
  • Form submissions that trigger approval processes

Leave a Reply

Your email address will not be published. Required fields are marked *