Edit

Share via


Start a flow in a canvas app (retired)

You can use Power Automate to create logic that performs one or more tasks when an event occurs in a canvas app. For example, configure a button so that, when a user selects it, an item is created in a list created using Microsoft Lists, an email or meeting request is sent, a file is added to the cloud, or all of these. You can configure any control in the app to start the flow, which continues to run even if you close Power Apps.

Note

When a user runs a flow from within an app, that user must have permission to perform the tasks that are specified in the flow. Otherwise, the flow will fail.

Enable classic Power Automate experience

By default, the new Power Automate pane is enabled by default. To use the classic Power Automate experience to create a flow, will need to switch back to the old experience manually.

Important

It’s recommended that you use the Power Automate pane to create a flow. The classic Power Automate experience should only be used for troubleshooting. The classic experience will be retired soon and won't be available.

  1. Open a new or an existing app in Power Apps Studio.

  2. Select Settings at the top.

  3. Select Upcoming features.

  4. Under the Retired tab, select Enable Classic Power Automate pane to set the toggle to On.

Prerequisites

  • Sign up for Power Apps.
  • Learn how to configure a control.
  • A SharePoint site with two lists.
    • List RepairShop contains Title, and ContactEmail columns.
    • List Assets contains Title, AssetType, and RepairShop columns. The AssetType column is a choice column with choices such as "Desktop", "Laptop".
    • The RepairShop column in Assets list is a lookup column that gets values from the ContactEmail column in RepairShop list.
    • Create a few items in the RepairShop list for sample contacts.

Create a flow

In this section, you'll create a flow using Power Automate that creates an item in a list using the input value for the list column from an app created using Power Apps. You'll create the app that uses this flow in the next section.

  1. Sign in to Power Apps.

  2. On the left-pane, select Flows.

  3. Select + New flow > Instant cloud flow.

  4. Enter flow name, such as FlowInApp.

  5. Under Choose how to trigger this flow, select Power Apps.

    Create instant flow using Power Apps trigger.

  6. Select Create.

  7. Select + New step.

  8. Under Choose an operation, search for or select SharePoint connector.

    Search or choose SharePoint connector.

  9. Search for, or select Create item action.

    Search or choose create item action.

  10. For Site Address, enter or choose your SharePoint site that has the lists Assets and RepairShop.

  11. For List Name, select the Assets list.

    Site and list.

  12. For Title, choose Ask in Power Apps from Dynamic content tab. The action automatically updates to Createitem_Title.

    Ask in Power Apps - create title.

  13. Choose values for AssetType Value, and RepairShop Id of your choice.

    AssetType Value and RepairShop Id.

  14. Select Save.

Add a flow to an app

In this section, you'll learn about creating an app using Power Apps that uses the flow created in the earlier section. The app uses text entered in a text box when the button is selected to trigger the flow to create an item in the selected list.

  1. Create a blank canvas app with a name such as AppWithFlow.

  2. Select + (Insert) on the left-pane.

  3. Select Text input control.

  4. Select Button control.

  5. On the canvas, move the button control below the text input control.

    Design the app.

  6. Select Action menu at the top, and then select Power Automate.

    Note

    Adding flow to the selected control or component clears out any existing formula for the chosen property. For example, when you add a flow to a button's OnSelect property that has a complex formula, the flow addition clears out this formula. Ensure you make a copy of the formula before adding the flow. However, this behavior is different when adding flow with Power Automate pane enabled. More information: Reference a flow

    Action > Power Automate.

    Alternatively, if you've enabled the "Enable Power Automate Pane" preview feature, you can chose your flow from the left-pane inside Studio.

    A screenshot showing the Power Automate button in the left pane with the Add Flow dialog opened, showing the FlowInApp flow available to add to the app.

    More information: Use Power Automate pane (preview)

  7. Select FlowInApp.

  8. In the formula bar, remove the formula for the selected OnVisible property.

  9. Select the text input control.

  10. From the top-left side of the screen, select the property list drop-down, and then select the Default property.

  11. In the formula bar, change the default property value from "Text input" to "Enter Asset Title".

  12. Select the button control.

  13. From the top-left side of the screen, select the property list drop-down, and then select the Text property.

  14. In the formula bar, change the text property value from "Button" to "Create Asset".

  15. From the top-left side property list, select the OnSelect property for the button.

  16. Enter the following formula in the formula bar.

    FlowInApp.Run(TextInput1.Text)
    

    In this formula, FlowInApp is the name of the flow you added using Power Automate. The .Run specifies the flow to execute. The flow executes with TextInput1 text input control added to this canvas, with the value entered in this text box (.Text).

    In other words, when this button is selected, the app will run the flow with the value from the text input control, passing the text value to the flow to execute. And the flow will create the list item with this text input value along with rest of the selection inside the flow configuration.

    OnSelect formula for the button.

  17. Save and publish the app.

Test the flow

Now that you have both the flow, and the app created, you'll run the app and verify the creation of an item inside the selected list.

  1. In Power Apps, select Apps, and then, select the AppWithFlow app.

    Run AppWithFlow.

  2. Enter a value in the text input box, and then select Create Asset.

    Run the app.

  3. Verify that the item is created in your list.

    Check list.

Now that you've created a sample app that runs a flow and adds item inside a list, you can create more complex applications that interact with Power Automate and manipulate data inside various data sources.

See also