Advertisement
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.
To create a button in a SharePoint list that triggers a Power Automate flow, start by creating an instant cloud flow using the “For a selected item” SharePoint trigger. Then, go to List settings Format current view and use JSON column formatting to add a button linked to the flow. The button will appear for each list item and allow users to manually run the flow. Ensure users have permission to run the flow and access the list. This approach enables quick, user-initiated automation directly from the SharePoint list.
ReplyDelete