How to launch Power Automate flow on click of a button from a row in SharePoint list item

Hello everyone and welcome to my blog. In today’s blog, I will show how you can launch a Power Automate flow using a button from a row in SharePoint list item.

The blog should help you to learn the following scenarios.

  1. Insert a button for a row in SharePoint list item
  2. Launch a Power automate flow on click of a button from a row in SharePoint list item

Through my blog I share interesting tips and discuss on latest releases of Microsoft.NET technologies, Dynamics 365 and Power Platform, SharePoint and Client scripting libraries. Please subscribe to my blog to stay updated.

Without further ado, let’s get started. I am using SharePoint list item to maintain a list of incidents. Illustration below.

The requirement is to show a button in each row to launch a Power automate flow. The flow in turn will change the status of ticket and update an external system.

Unfortunately, at the time of writing this blog, SharePoint does not have support for button columns. However we can easily convert a text column to display as a button and launch a Power Automate flow.

Let’s start with a Text column. I created a Text column. I have named the Text column to ‘Update status‘.

Once the column is created, select Column settings -> Format this column

On the format dialog, chose ‘Advanced mode‘. Highlighted in below illustration.

Copy and paste the below code.

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "button",
   "txtContent": "Update ticket status",
   "customRowAction": {
      "action": "executeFlow",
      "actionParams": "{\"id\": \"<workflow-id>\"}"
   }
}

Make sure to replace the workflow-id with the GUID of the power automate flow. If you have done everything correctly, then your button should show up as shown in the illustration below.

Please note that you can only execute flows which have – “For a selected item” trigger.

All set and done. When I click on the button, the flow panel show up.

If your flow have input parameters, you can provide them too before you can execute from the flow panel.

Wonderful isn’t it? If you want to show the Power automate icon in the button, you can copy and paste the below code.

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "button",
   "customRowAction": {
      "action": "executeFlow",
      "actionParams": "{\"id\": \"fbed7f53-01f3-4e3b-8238-162f082da7be\"}"
   },
   "children": [
      {
         "elmType": "span",
         "attributes": {
            "iconName": "Flow"
         },
         "style": {
            "padding-right": "6px"
         }
      },
      {
         "elmType": "span",
         "txtContent": "Update ticket status"
      }
   ]
}

Below is the output.

That’s all in this blog for today. In my next blog, I will show how you can customize the look and feel of the Run flow dialog.

I hope this helped. If you have liked the post and if this post has helped you, please subscribe to my blog.

Debajit Dutta