Forum Discussion
CR-88
Oct 12, 2021Copper Contributor
SharePoint Online Button to run Flow
I have a Power Automate flow and a SharePoint Online list, I created a button following this discussion. The problem is my button is created but it's not running the workflow, I tried to debug the workflow but workflow is not running.
My workflow starts by selected an item in the SharePoint Library, then sending an email, and then looking for approval.
This is the code of my button:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"Flow ID\"}"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
},
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flow"
},
"style": {
"padding-right": "1px"
}
},
{
"elmType": "span",
"txtContent": "Submit"
}
]
}
Thanks
- RobElliottSilver Contributor
CR-88 your JSON code needsto look like this, changing the txtContent to the text you want on the button, and the id needs to be your flow's ID:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "button", "txtContent": "Press this button", "customRowAction": { "action": "executeFlow", "actionParams": "{\"id\": \"70bcc1be-c1af-436c-94a6-50828b1582ef\"}" }, "style": { "background-color": "#460302", "color": "#ffffff" } }
As this is to work with a document library, your trigger in the flow must be the SharePoint "for a selected file". If it was a list it woujld be "for a selected list"
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)