Some scenarios
we need to trigger a flow for a selected item, in that case we can add button
in the SharePoint list view itself, using JSON we can add the button easily to
trigger a power automate from default environment.
Step 1: Create a single line of text column as per the below screen shot.
Click on the flow name, in the
browser we can get the flow id.
Add the JSON code as per the below.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Start
Approval",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\":
\"e4691fd4-368c-4ae7-8b1f-4e998a9c7a42\"}"
}
}
Button will be created as per the below screen shot
If we want to design the button
with different color, we can use the below code.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Start
Approval",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"e4691fd4-368c-4ae7-8b1f-4e998a9c7a42\"}"
},
"style": {
"background-color":
"Green",
"color": "white",
"cursor": "pointer"
}
}
Once you click on the button
workflow will start automatically, hope this will helps.