A Power Automate flow on a SharePoint list selected item can be executed by adding a Flow launch button using JSON. We can do the column formatting in modern list view to add a custom button which can be used to launch flow on selected item. If you check the above screenshot, the approval column is showing column values are changed based on the selected status.

Prerequisites

You would need JSON script for generating the Flow launch button. But before we start, create a new column on your SharePoint list and make sure you a Power Automate flow created for that list. We would need the Flow GUID which can be copied from the flow URL page.

Add Flow Launch button JSON

Go to https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-advanced site and copy the JSON form as shown in below screenshot

Click on the column name, go to Column Settings and click on the Format this column button. Now a panel on left will be opened, click on the Advance Mode, this will open the editor view. Now you can copy the above JSON script to the text editor and replace the Flow GUID in the script as highlight in above screenshot. I have used conditional formatting in the style section to hide the flow button if Flow is completed, and secondly on button text to rephase the button text to Restart Approval.

Style Section

"style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer",
    "display": "=if([$Status] == 'Completed', 'none', 'display')"
  },
Button Text
"txtContent": "=if([$Status] == 'Rejected', 'Restart Approval', 'Start Approval')"

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply