Skip main navigation

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

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education