In my previous blog post, we created a Flow which can be manually started on a document in a SharePoint Online document Library or List. In this blog, we will create a button using column formatting which will launch a Flow on that item.
Please make sure the following prerequisites are in place:
- Create a Flow which Converts and adds a Text Watermark to the PDF.
- Create a column in SharePoint Online list\document library of type Hyperlink.
Step 1: Navigate to https://flow.microsoft.com and open the Flow that we created in our previous blog post.
Step 2: Copy the ID from the end of the URL to the clipboard. For example https://emea.flow.microsoft.com/manage/environments/Default-444e7b96-eeb2-45d5-a9ff-4bef8830b240/flows/8537634d-2e56-4d98-a494-ed856b68a70a/details
Step 3: Navigate back to the SharePoint Online document library, click on the column (Button) drop down and click on “Format this Column“.
Step 4: Use the GUID that we copied in Step 2 in the JSON below.
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json“,
“elmType”: “span”,
“style”: {
“color”: “#0078d7”
},
“children”: [
{
“elmType”: “span”,
“attributes”: {
“iconName”: “Flow”
}
},
{
“elmType”: “button”,
“style”: {
“border”: “none”,
“background-color”: “transparent”,
“color”: “#0078d7”,
“cursor”: “pointer”
},
“txtContent”: “Run Flow”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”8537634d-2e56-4d98-a494-ed856b68a70a\”}”
}
}
]
}
Step 5: Copy the JSON below in the Column Formatter and Click on Save, you should see the Button Hyperlink.
Thanks for reading 🙂.