One of the best things about the Power Platform is that the tools can be easily connected, so you can easily send parameters from one to another. This way, you can take advantage of the strengths of each tool while keeping things separate. For example, let's say that you have a Power App that manages expense reporting. You can have a Power App where you can submit the information and upload the document but then have a Power Automate Flow that can trigger the approval process.
You can even have your Power App, which is your control center, meaning that you can have a lot of buttons that trigger your Flows when you need them. Using the same example above, you can have a button that triggers a recurrent expense and another that calls the holiday submission process. It gives you one place for all your Flows.
I've covered some of the topics in my PowerApps trigger article, but I wanted to refresh the information with the new version of the trigger and show you some "gotchas" that could confuse you.
The Flow
To be able to provide information, you need to use the "PowerApps trigger" in Power Automate. There are two versions of the trigger. The first doesn't have input parameters, and it works as described in the reference. In this article, we'll use the V2 of the trigger since it clarifies things, as you'll see.
Let's start by adding the trigger. To do that, select "PowerApps".
Notice that Power Automate automatically suggests the Power Apps trigger at the bottom but don't pick it. That's version 1 of the connector. If you see something like this, please delete it and select the "PowerApps (V2)" trigger.
Here's how to pick it.
Here's what it looks like:
It looks similar to the "Manually Trigger a Flow Trigger," where you can pick the type of data you want to provide. It behaves pretty much the same way as well. Let's add a new text field where we can provide a parameter. Click "+ Add an input".
Then pick the name of the input. I'm not inventive, so I'll call it "Text".
Let's add a "Compose" action to find the provided data. As you can see, the input is selectable, and the name is the same as the input. It's much better than V1 because it makes the parameters more straightforward.
Our work is done for our test, so let's go to the Power Apps side and check how to find this Flow.
The Power App
Let's look at the Power Apps side now. To test, let's create a simple app with a text input and a button like this:
Now the button must react and send the information back to Power Automate. To do that, we need first to add automation to our app. It's pretty simple since we have a dedicated button to do that. You can find it in the sidebar on your left.
[Screenshot needed: Updated Power Automate pane in Power Apps Studio, showing "Create new flow" and "Add a flow"]
In the current version of Power Apps Studio, open the "Power Automate" pane in the left menu, then select "Add a flow". The screenshots below show the older "Add flow" route, but the steps are the same. Your existing formula is kept, so you write the call yourself, as we'll do below.
If you didn't do the previous setup on the Power Automate side, you could press the "Create new flow," which will create a new Flow for you. Since we've created it, let's push "Add Flow". You'll see a popup like this:
Select the Flow. In our case, we named it "Article - Power Apps Parameters," so that's the one we'll add. If all goes well, you'll see it below.
Now let's trigger the Flow. To do that, we'll use our button. First, click the button, then go to the left side tab, select "Advanced" and then "OnSelect".
If you don't see this properly, don't worry. It's probably because the button is not selected. Click on the button, and you'll see it.
The default value is "false" which doesn't help us a lot, but since we imported the Flow before, we have it available now to run. To do that, remove the "false" and start typing the name of the Flow. In my case, it's called "Article - Power Apps Parameters", so if I start typing, here's what I get.
Notice that we selected the ".Run" version at the end. We will use that to pass the parameters to Power Automate. To do that, let's add to the TextField, but you don't have to type the whole name. Take advantage of the autocomplete feature and the "tab" key to fill it in like this:
If you don't know the name, look at the "Tree View" on the right sidebar and see it there.
Let's run and push the button.
If all goes well, you should see the following on Power Automate's side:
Let's check the Flow and see the value.
That's it. Now we have a value in Power Automate that we can parse however we want.
Sending a value back
Sometimes the app needs an answer from the flow. To do that, end the flow with the "Respond to a PowerApp or flow" action and name each value you want to return.
In the app, store the result in a variable and read each value by its name:
Set(varResult, 'Article - Power Apps Parameters'.Run(TextInput1.Text))
Here, varResult is a variable that holds everything the flow returned. A value called message is then available as varResult.message. The app waits for the flow to finish before moving on.
The Set pattern comes from community sources. Test it in your own app before relying on it.
Non-intuitive behaviors
Refresh the flow after editing it outside Power Apps Studio
If you change the trigger inputs in the flow editor, the app keeps the old version of the call. Open the "Power Automate" pane and select "Refresh" next to your flow. Otherwise, the flow can fail, even in apps you already published.
Switching from V1 to V2 can break the flow
If you upgrade an existing flow from the V1 trigger to the V2 trigger, it can fail with a connection error. Remove the flow from the app, add it again, and save the app.
Parameters can be intercepted
The values you send travel as network traffic, so someone could change them before they reach the flow. Validate the values inside the flow before acting on them. For example, check that an email address belongs to your own domain.
Limitations
Power Apps waits 120 seconds for a response
When an app calls a flow, the flow must respond within 120 seconds. If it doesn't, the app shows an error. If your flow needs longer, add the "Respond to a PowerApp or flow" action near the start. The rest of the flow keeps running after it responds.
Your Questions
How can we add more than 19 parameters in the V2 trigger? (D. Huddleston)
Community reports suggest the trigger tops out at around 19 inputs. Microsoft doesn't document the number, so treat it as approximate.
The simplest way around it is to send one value instead of many. Build a single piece of text from all your values with the "JSON" function in Power Apps, and pass that as the only input:
'Article - Power Apps Parameters'.Run(JSON({name: InputName.Text, email: InputEmail.Text, company: InputCompany.Text}))
Then add a "Parse JSON" action in the flow, use the trigger input as its content, and every value shows up as its own item. As a bonus, the call is easier to read, because each value has a name.
Why does the app show text_1, text_2 instead of my input titles? (Mark-Andrew)
The V2 trigger passes its inputs by position, not by name. The app matches the first value you type to the first input in the flow, the second value to the second input, and so on. The names you see in the hint don't affect the result.
Keep the order of the inputs in the flow the same as the order in your call. If you change the order later, refresh the flow in the app. If the names matter to you, the JSON approach from the previous answer gives every value a proper name.
The position-based matching is community-reported. Test it in your own app before relying on it.
How do I add multiple inputs? My call with three inputs doesn't work (Karelyn Yep)
Your call is built the right way. Separate the values with commas, in the same order as the inputs in the flow. If it still fails, these are the usual causes:
- The app has an old version of the flow. If you added the inputs after adding the flow to the app, open the "Power Automate" pane and select "Refresh" next to the flow.
- The number of values doesn't match the number of inputs. A required input needs a value, so three inputs need three values.
- The flow doesn't respond with
contactlist. The flow needs a "Respond to a PowerApp or flow" action with an output named exactlycontactlist, in lowercase. - The response isn't text. "ParseJSON" reads text. Make the output a JSON string in the flow, for example with the "string" function, and then convert the items you read from it, for example with
Text(...).
If you're still stuck, tell me which part shows the error and what it says, and we'll take it from there.
Final Thoughts
Passing a parameter from Power Apps to Power Automate takes three steps. Add the trigger with an input, add the flow to your app, and call "Run" with the value. Once you've done it, the same pattern works for every button in your app.
Photo by Elaine Casap on Unsplash
I love how you encourage exploration of diverse ideas,
How can we add more than 19 parameters in the V2 Trigger?
The answer is to send one JSON text built with the "JSON" function, then add a "Parse JSON" action in the flow. I called the 19-input cap "around 19" and said Microsoft doesn't document it. It only comes from community reports
i see in powerapps trigger (not v2) the input property is set to a name that matches the input so you can see that in apps when executing a flow
in powerapps v2, it assigns text_1 text_2 etc for text inputs, i see this in the schema but i see no way to change this property so it shows in the app as x.run(text_1, text_2) and not the title etc
I explained that V2 inputs are matched by position, so the names in the hint don't matter, and pointed to the JSON approach for named values. This is from community reports only, and I marked it with an info callout.
how to add multiple input ? This statement doesn't seem to work, I have 3 inputs added inside the automate powerapps
Set(varResponseC,ParseJSON(GetContact.Run(InputCompany.Text, InputName.Text , InputEmail.Text ).contactlist));
Looks good but added more details in the article to help debugging