Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Canvas

.

Starting a Microsoft Flow form a PowerApps canvas app allows offloading work from the canvas app to flow.

This can be done to allow the work to continue in the background without making the user wait or simply to take advantage of the flow to do work that might be too complex to fit into an expression in the canvas app.

When a canvas app starts a flow, it can pass parameters to the flow to customise the flow execution. The flow can respond to the canvas app when it completes with results from the flow execution. This pattern sets up the possibility that the flow could also become reusable and called from multiple canvas apps to perform the same reusable logic.

Using the PowerApps Trigger

To make a flow usable by a canvas app you must add the PowerApps trigger to the flow.

Screenshot of the PowerApps trigger

You will notice the trigger itself doesn’t offer any way to configure the parameters you want to have the canvas app provide. This is done as you build your flow via the dynamic data panel. As you click in a field on an action in the flow and the dynamic content panel shows, you will notice it contains an Ask in PowerApps item as you can see in the following example.

Screenshot of configuring parameters

By selecting Ask in PowerApps it will create a field that is expected to be passed from the canvas app. The parameter’s data type is inferred from the field. So, if you bind it to a text field, the parameter will be a text field also. Once you add parameters you can’t remove them so use care when selecting Ask in PowerApps. The order of the parameters is based on the order you select and add them and is not changeable.

Responding to PowerApps

A flow is not required to respond to a canvas app, however, it does offer a way to communicate back the status of the flow run. To respond, add a Respond to PowerApps action to your flow. The following is an example of that action.

Screenshot of adding a Respond to PowerApps action

You can add one or more fields to the action based on the data types available. These become properties on the response object and are available to the canvas app for further processing. You set the values of these properties on the action either statically, or by binding them to data using the dynamic data panel. Often variables make a good place to store the work in progress data values as the flow executes and then you bind these actions fields to the variables.

Calling From the Canvas App

Once the flow has been built, to use it from the canvas app you need to first reference it. You can do that from Action -> Flows and select the flow you just built.

Screenshot of referencing the flow in the Canvas app

Once the flow has been referenced you can then call it from a button behaviour like OnSelect. The following is an example of calling a flow from OnSelect. The expression saves off the response from the flow and then uses Notify to share the response with the app user.

Screenshot of example of calling a flow from OnSelect

Starting flows from canvas apps is a good way to offload work to the flow. Look for opportunities where this would improve the user experience in the canvas app, or where it would allow completing work that otherwise couldn’t easily be done in an expression in the app. Remember, reusable flows also encapsulate the reusable logic that can be used by multiple canvas apps.

This article is from the free online

Dynamics 365: Working with Power Platform Automation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now