Return data to PowerApps from a flow
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
These release notes describe functionality that may not have been released yet. To see when this functionality is planned to release, please review Summary of what’s new. Delivery timelines and projected functionality may change or may not ship (see Microsoft policy).
Use Microsoft Flow to create logic that performs one or more tasks when an event occurs in a PowerApp. For example, configure a button that creates an item in a SharePoint list, sends an email or meeting request, or creates an online file. You can also use a flow to return data to PowerApps. For example, configure a flow that retrieves data from a web endpoint, SQL Server, or an Excel file in SharePoint, and then processes that data by using built-in actions. You can configure any control in the app to start the flow, which continues to run even if you close PowerApps.
To set up a flow that calls data from PowerApps, first start your flow with the PowerApps trigger.
Next, add whatever actions you want to run when your flow is called. Inside these actions, you can use the Ask in PowerApps option to collect additional parameters from the PowerApp.
After you have built your flow and collected the data you need, add the Respond to PowerApps action. In this action, define the output fields you want to provide to PowerApps. Name each field, and select Add Dynamic Content to pass in data from the actions in the flow.
The last step is to add your flow to the PowerApp in the formula bar. Select the control to run your flow from, and then, on the Action tab on the ribbon, select Flow. Select the flow you created to add it to the formula bar, and pass any parameters that the flow requires.
We recommend that you use Set() or UpdateContext() to set a variable that stores the result of your flow. That way, if multiple values are returned from the flow, you can access different properties in various places in your app. For example, the preceding flow returns two properties, most_sales and sellers, and you can use either on a control.
View result properties
Today, you can return basic types such as Text or Email. However, there might be cases where you want to return a list of data to the PowerApp, such as a list of names. In this case, you can use the Join action inside your flow and then use the Split function in your PowerApp.
Use results in the gallery
In the preceding example, notice that the result of the flow is set in SalesInfoVariable, and then the gallery is bound to the table output by splitting the names on a comma. If you have an array of objects in the flow, use the Select action first, to choose the property you want to pass to the PowerApp before joining the array.