DEV Community

Wai Liu
Wai Liu

Posted on

Trigger an instant flow from a canvas app - simple example

1. Create a canvas app with three components

Image description

  1. Text input will what we send to the Instant Flow
  2. Create Task button will be the trigger
  3. LabelResult will be what is returned

2. Create Instant Flow

In a solution, create a new Instant Flow

Image description

Select Power Apps as the Trigger and call it "Instant Flow"

Image description

Edit the Instant Flow

Image description

There should be 3 steps

PowerApps - That's the first step - as it's an instant step, you don't have to do anything

Add a new row - this is specific to this example and all I'm really doing is going to create a task with the subject of all the input I'm putting into the flow

Image description

(Optional) to create inputs go to the Dynamic Content tab and click Ask in PowerApps

Image description

Respond to a Powerapp or Flow - this step returns an output back to the canvas app. For our experience we'll just put a success message.

4. Hook up the Canvas app to use the Instant Flow

Select your button, click on Action at the top, then Power Automate and select the Flow you want

Image description

Image description

Then Edit the formula so it is Set(Var1, InstantFlow.Run(User().Email, TextInput1.Text, "extra"))

Breaking down the formula

InstantFlow.Run will trigger the flow - it asks for 3 variables so I've put them in there.
Set is setting a variable with the variable being the first parameter and the second being the value of the variable. So here you're saying set Var1 to be the output of the InstantFlow.

Set the LabelResult

Lastly you want the LabelResult to display the returning message from the flow so click on it and put in Var1.result as the text message

Image description

Discussion (0)