Conditional Formatting on SharePoint list with Flow Button

Published: Updated: 2 min readPower Platform
Conditional Formatting on SharePoint list with Flow Button

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.

Flow Button

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

Flow Button

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')"
Share:
Adnan Amin

Adnan Amin

Adnan Amin is a Microsoft MVP for Microsoft 365 (since 2015) and a Senior Microsoft Consultant. He writes practical guides and PowerShell scripts for SharePoint, OneDrive, Teams and Copilot admins.

More posts by Adnan Amin

Leave a Reply

Your email address will not be published. Required fields are marked *