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, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

Leave a Reply