Power Automate and the Power Apps trigger – part 1 – How to create and trigger a flow from your Power App
This blog series will cover the Power Apps trigger in Power Automate. I will describe how you can trigger a flow from your Power App, how you can provide parameters from your Power App to your flow and how to impersonate actions.
This is part 1 of this blog series, which will cover triggering a flow from your Power App.
PowerApps connector
First of all, what is the PowerApps connector? It basically provides the option to communicate with a flow directly from your Power App (and back again), without having a data source between both.
The Power Apps connector can be found under the Built-in tab:
For the observant reader: yes, it’s still called PowerApps instead of Power Apps 🤔
Triggers
The PowerApps connector has two triggers:
- PowerApps
- PowerApps (V2)
Actions
The PowerApps connector only has one action:
- Respond to a PowerApp or flow
More on these triggers and this action later on in this series.
Create a flow from your Power App
To trigger a flow from a Power App, you must first create a flow that has a one of the above PowerApps triggers. You can do this manually (via https://make.powerautomate.com) or directly via your Power App.
Create flow directly from your Power App
To create a flow directly from your Power App, there are two ways to do that, depending on your Power Apps Studio version.
Current
In the current Power Apps Studio version, you should go to Action > Power Automate > + Create a new flow.
This will bring you to a new windows that provides you with all templates that make use of the Power Apps trigger. The Power Apps button template is the most basic template that provides you will all the flexibility to create your own custom flow.
The Power Automate sidebar will also show any existing flows that you can add to your Power App.
Power Automate Pane
If you’re running Power Apps in Preview, you can use the new Power Automate pane to work with flows directly from within your Power App. The Power Automate pane can be accessed the same as above (Action > Power Automate), but also from the left Panes menu using the Power Automate pane. From within the Power Automate pane, simply click Create new flow (when there are no flows yet) or Add flow > Create new flow.
This will open the Power Automate Studio from within your Power Apps Studio, allowing you to select a predefined template or just create a new flow from blank. Editing your flow will also happen inline so you don’t have to switch back and forth anymore.
If your tenant is not set to use Preview, but if you want to use the Power Automate pane, you can enable it per app by going to File > Settings > Upcoming features and enable the Power Automate pane feature from there.
Please note that at the moment of writing, this is still officially in preview, so I won’t recommend this for Production scenarios.
Trigger a flow from your Power App
In this case, I will demonstrate how to trigger the flow from a Power Apps button, but you can use other events as well.
When you’re done editing your flow, make sure to save it first. Only then will it become visible from your Power App.
Current
To add the flow to your button, simply go to the OnSelect property of your button. Then, go through Action > Power Automate again and click the flow you just created (from the Available flows section). This will add the flow to the OnSelect of your button:
This will add the PowerFX formula for starting a flow to the OnSelect property of your button. The only thing you have to do is close the .Run tag and you’re ready:
'Testing-PowerAppsbutton'.Run()
Clicking the button will now run the flow.
Power Automate Pane
When using the Power Automate pane, the experience of adding a flow to your button is slightly different. You should go to the Power Automate pane and click the Add flow button to add the flow to your Power App if it’s not already added (it will be added automatically if you’ve created the flow directly from your Power App using the Power Automate pane).
To add the flow to your button, you must manually type in the PowerFX formula (or a part of it and complete the formula using the intellisense option) in the OnSelect property of your button.
PowerApps vs. PowerApps (V2)
As mentioned earlier, there are two PowerApps trigger; the PowerApps trigger and the PowerApps (V2) trigger. But what are the differences?
Obviously, the PowerApps (V2) trigger is newer, but pressing the help icon doesn’t provide us with much information unfortunately:
The differences I’ve found so far are related to Input parameters and impersonation.
Please note that the PowerApps trigger will be used by default when creating a flow from a template. If you want to use the PowerApps (V2) trigger, you have to manually alter your trigger or create a flow entirely from blank (from outside of your PowerApp).
Stay tuned for the next parts of this blog series in which I will cover parameters and impersonation.