cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sergio_Carol
Regular Visitor

Trigger a flow with sharepoint button

Hi, 

How can I trigger a Flow by pressing a SharePoint button? Is it posible whitout Power apps?

Thanks

2 REPLIES 2
RobElliott
Super User
Super User

@Sergio_Carol yes this can be done without Power Apps using a combination of a flow and JSON column formatting of the list column. We use this a lot in our lists & libraries at my company.

For the button you will need a single line of text column in your list:

0-SP-List.png

In your flow use a SharePoint of For a selected file (if the button is in a library) or For a selected item (if it's in a list):

1-ForSelectedFile.png

 When you've saved your flow copy the id of the flow from the address bar:

2-flowID.png

Back in your SharePoint list you need to format the column where the button will be and go to Format this column:

3-formatColumn.png

Then add in the JSON code below, changing the id to your flow's ID:
4-JSON.png

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Publish to Teams",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"021ec4e0-8f85-46b3-a557-a4456960a4eb\"}"
  },
  "style": {
    "background-color": "#468259",
    "color": "white",
    "visibility": "=if(([$PublishedToTeams] == 'Yes'),'hidden','visible')"
  }
}

 

I've added a background color and changed the font color and also added a condition that only displays the button my column PublishedToTeams is not equal to Yes. But you don't need that to make the button work - the default styling is shown in the Email column next to the Teams column. You will need to change the text on the button and this is done on the txtComment line. When you press click the button the flow will run - you will be asked to confirm the run each time.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

 

Thank you @RobElliott

 

I understand (more or less 😀) your answer but my problem is in a SharePoint web button, not in a library or list. I think I only can use a URL link.

 

 

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (22,993)