Trigger flow from web part

Copper Contributor

Hi, I'm pretty new to sharepoint and I'm wondering if there is a way to directly trigger a flow from my sharepoint web part instead of in the list page. 

 

Right now I have a button in a list to start a flow and it only works in the list page, not the web part. Is there a workaround for this?

 

Thank you!

1 Reply

Hi @mingyk,

To trigger a flow from a SharePoint web part you can try to use a Power Apps button.

Here are the steps on how to create a Power Apps button and trigger a flow from a SharePoint web part:

  1. Create a Power Apps button.

    • Go to Power Apps and create a new canvas app.

    • Add a button to the app.

    • In the OnSelect property of the button, add the following code:

      Launch(
          "https://flow.microsoft.com/manage/environments/{EnvironmentName}/flows/{FlowID}/run"
      );

      Replace {EnvironmentName} with the name of the environment where your flow is located and {FlowID} with the ID of your flow.

    • Save and publish the app.

  2. Embed the Power Apps button in a SharePoint web part.

    • Go to the SharePoint page where you want to add the button.
    • Add a Power Apps web part to the page.
    • In the App property of the web part, select the Power Apps app that you created.

  3. Create a flow to be triggered by the Power Apps button.

    • Go to Power Automate and create a new flow.
    • Select the "When a button is clicked" trigger.
    • In the OnSelect property of the trigger, select the Power Apps button that you created.
    • Add the actions that you want to perform in your flow.
    • Save and run the flow.

 

Here are some useful links regarding your issue:


Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)