Button in SharePoint List to Trigger Power Automate

In SharePoint modern lists, conditional formatting can be done, and there is a great detailed reference by Microsoft. I was trying to find a way to create a nice pretty button right there on a SharePoint list, to quickly click to run a workflow.
6/23/2022 Update: I’ve written a newer, better way to accomplish this
(Action Button in a List – Set Column Value) – Scroll to the part of this new post that says “But Wait There’s More!”
With that in place, end users won’t have to wonder which menu and where to click in order to get that item approved (or run any workflow at all).
Microsoft’s reference on how to do this is here.
After reading this and trying it myself, I made a couple of tweaks to it, that you may like. In this post, I’ll explain how it works, and what I did. Here are a couple of examples, one with a list (Customers), and one with a library (Policies):
There are two ways I’ll demonstrate, one way is with a hyperlink, and the other with a button. The Policy Owner column above is a hyperlink, and the Button column is a button.
Check out my Advanced Power Automate Course
First of all, you’ll need to decide which Flow you want to run, and get the GUID of it. Here’s how to create a flow if you don’t already have one, using a specific template for manager approval. The important thing is that its trigger is based on the selected item, NOT based on when an item is created or modified.
- Go to https://flow.microsoft.com
- In your list or library, click the Flow drop-down in the toolbar, and choose Create a Flow.
- Choose the Flow called “Request manager approval for a selected item”.
- On the next screen, click Continue.
- Now, in the flow design screen, click Save at the top right.
- Go back to your list of Flows, and then open this Flow. For any flow in your list, here’s how to get the GUID, it’s in the URL.
- My URL looks like this https: //us.flow.microsoft.com/manage/environments/Default-9d3ccee1-5cf8-4e08-887c-53b2a210967b/flows/de138f88-1e85-5d0f-a3ad-fa9b0c9e5ac5/details. I just need that part in red. Copy just that part to your clipboard. de138f88-1e85-5d0f-a3ad-fa9b0c9e5ac5
- You’ll also need to share this Flow so that other people can run it besides you. Add users or AD groups as run-only users:
Next, I’ll show you how to create the column as a hyperlink. It doesn’t matter what kind of column it is, or even if it has a value in it or not.
My policy owner’s name is in a people column called Policy_x0020_Owner
-
- Go to your list or library, click on the name of the column, and click Column settings, then choose Format this column.
- Your pane will show on the right side of the screen, to paste this code in.
- Go to your list or library, click on the name of the column, and click Column settings, then choose Format this column.
{
“$schema”: “https: //developer.microsoft.com/en-us/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”: {
“operator”: “+”,
“operands”: [
“[$Policy_x0020_Owner.title]”,
“ Approval”
]
},
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”86dfdf10-8d99-4914-8e98-fe4b21ed7e34\”}”
}
}
]
}
- I’ve color coded the parts that I changed, to explain what each one is.
Red – My Flow GUID that I obtained in that first set of steps above
Purple – the name of my column. The only reason I had to put the .title in it, is because it’s a person column. All column types don’t need this extra part. Reference.
Blue – the word that I’m showing after the person’s name
Green – the name of the icon that I’m showing in front of the person’s name. This one is called Flow, but there are bunch of others here.
Next, I’ll show you how to create the column as a button, shown above in my Button column, which is just a text column with nothing in it. Do step one from above first, then in the column formatting box, use this code:
{
{
“elmType”: “button”,
“txtContent”: “Get Approved“,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”f191e7c8-1a36-4553-9d64-607764fc6f83\”}”
}}
This one is much simpler. I didn’t make the text dynamic at all, it just says Get Approved for all of them. Clicking the button launches my Flow.
Red – my Flow GUID.
Blue – the words on the button
What if I want the button to be a different color? Then, the code would look like this instead, with a purple button with white text:
{
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”86dfdf10-8d99-4914-8e98-fe4b21ed7e34\”}”
},
“style”: {
“background-color”: “purple“,
“color”: “white”
}}
What if you only want the button to show under a certain condition. In this example, I only want this button to be visible if the content approval status is “Pending”. Here’s the code for that:
{
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”86dfdf10-8d99-4914-8e98-fe4b21ed7e34\”}”
},
“style”: {
“background-color”: “purple”,
“color”: “white”,
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$_ModerationStatus]”,
“Pending”
]
},
“visible”,
“hidden”
]
}
}
}
In the above code, here are the important parts:
Red – my column’s system name is _ModerationStatus
Blue – the value of the status is pending
In the syntax, a question mark (?) operator is used to create a condition, like an IF statement. So, in the “visibility” section of the code above, we’re saying IF the ModerationStatus equals (==) Pending, then “visible”, otherwise (if it’s not pending), then “hidden”.
Here’s my SharePoint Power Hour video where I demonstrated how to do all of this, along with how to do the workflow that works with the content approval status in the list/library.
Hi Laura,
Nicely done, but I have a couple of questions.
1. Does the flow need to have already been shared with the SharePoint list that the flow is acting on?
2. If yes, what minimum license level for Flow is needed to enable that?
1. No
2. This isn’t a particular Flow license level, I only have Office 365 E1.
Hi laura, If I add the list webpart on the modern page, the flow panel doesn’t opens up , while it is opening if I do the same thing by directly going on the list, Is this is the microsoft bug?
Hi Laura,
Wonderful item, but unfortunately not what we’re looking for.
Is there any method to create a ‘fixed’ button on a modern SharePoint site (page) to start a Flow that has been defined as a Manual triggered Flow (asking for some text input and a link to a document file)?
When you share a flow with someone as a run-only user, the email it sends has the link to directly trigger the flow, and then you can use that link on a button on your site or anywhere.
Hi Laura,
Thanks for this blog, but as always it asks more questions 😉
I would like to show a button when a document is published. This starts a Flow so that it makes a copy of the document and copies it to the correct language intranet. This flow works well.
But I do not get the condition right in JSON.
How do I get this done when Version ends with .0?
Is this a solution or do I have to think about another way?
Can you help me with this?
thanks in advance
I’d be interested to learn more about this…I would like to trigger a flow that would convert a Word doc to pdf and add the pdf to a different list.
Hi can we update a column in sharepoint list on click of a button which we create using column formating
how to run a custom code using JSON button in SharePoint
None of these work when I paste them into my column formatting dialog. It says, “Please enter valid column-formatting JSON.”
If you copied and pasted then the quotes are most likely the wrong characters. Change all the double quotes to double quotes, i.e. ” not “ or
I also can’t get any of these to work when I paste them into my column formatting dialog. Even if I paste them into Notepad first for standard character formatting. What am I missing? I would really like to use this one for the button format, but it always gives “Please enter valid column-formatting JSON.”:
{
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”86dfdf10-8d99-4914-8e98-fe4b21ed7e34\”}”
},
“style”: {
“background-color”: “purple“,
“color”: “white”
}}
Try re-typing your quotation marks. I’ve seen those mess up when copying and pasting.
The basic button snippet has an extra right hand curly-brace too
copy the code and You have to edit “ –> ” then you will get rid of Error
I also had to remove the scheme line “$schema”: “https: //developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json”,
I need to start a Flow from a single button on a SharePoint page. The Flow has a “Manual” trigger. Can you please tell me how I can add it to the “onclick” attribute: <input type="Button" style="background-color:#a7cb00; width:250px;font-size:13pt" onclick="window.location=
In my last comment it looks like the blog software changed my quotes too. In any case, just use a normal double quotes. You have to replace them all.
Hi Laura, the URL for my Flow isn’t quite the same as yours, and I’m trying to parse out the GUID, and could use a little help: https://us.flow.microsoft.com/manage/environments/Default-60b81999-0b7f-412d-92a3-e17d8ae9e3e0/flows/bf454aa9-d6fe-4614-b790-6e2beb08c1f6?backUrl=%2Fflows%2Fbf454aa9-d6fe-4614-b790-6e2beb08c1f6%2Fdetails
Your GUID is everything after “/flows/” and before “?”, so: bf454aa9-d6fe-4614-b790-6e2beb08c1f6
Hi Laura,
Good Day.
I just want to ask a question about your post.
Is the flow you created can be run by other user who had access to list? or is it only applicable to the owner of the flow itself?
Thank you in advance.
TinnyWinnie
It can be run by end users who have access to the list.
Hi Laura,
Thank you for the quick reply. 🙂
This is great. I’ll try it on our side.
Hi Laura, I have been able to follow along the instructions with the addition of a button working well. What is not working for me though is the button only showing based on column status – I am not receiving any errors in the json code box its just the button doesn’t appear at all now after extending the code. Is there anything else I need to be aware of when using this? Thinking maybe the format of the column of the status or anything? I feel so close but yet so far to completing this work!!!
Hi Laura, will the option to show button after approval status has been met work on any other field in the SharePoint list or does it have to be the approval field? Sorry for the repeat query, just trying to get it to work!! 🙂
There’s a reference in the JSON to “current field” versus @fieldname. So if you want the logic to use the current field, use that, but if you’re referencing a different field, you have to use the ampersand. I don’t remember the exact syntax off the top of my head, but it’s definitely different.
How do you pass parameters? What is format?
Okay, I’m at a loss. I wrote the following code based on your example and it doesn’t seem to matter what I put in the ButtonVisible field, the button is always visible. I checked to make sure that it has the correct system column name. It does. I thought maybe Visible is a reserved word, so I replaced it with Yay/Nay. That didn’t work. I have no idea why it won’t execute correctly.
{
“elmType”: “button”,
“txtContent”: “Mark Complete”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”:\”b9437ba0-a6a9-4a72-be9e-277f4604bbc1\”}”
},
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$ButtonVisible]”,
“Visible”
]
},
“visible”,
“hidden”
]
}
}
Update: I figured out that if I add in the code that you added to change the text and background color, it works fine. I was a little worried about that, because I didn’t want a purple button. However, I figured out I can change it to light grey and it looks fine.
Hi,
I have the buttons working in a list, pretty cool.
And when the list is viewed on a modern page in a list view web part, the buttons do show.
But they are not clickable.
Any thoughts?
I have the same issue. Anybody know of a way to allow the buttons (or really, any of the additional tools) to work in a webpart without having to open the library?
Hopefully Microsoft will fix this little bug. I guess in the meantime we have to make the users do that one little extra click to get to the list / library.
I love finding posts like this. Thank you for the detail.
has anyone yet found a way of doing this with a calendar based list, so not modern view?
Nope.
If only I’d come to this blog in the first place and found that my Flow had to have a custom trigger!! Every day’s a school day… :o)
Hi Laura,
I am new Flow workflows and I am creating multilevel approval workflow. In SharePoint Designer workflow we have action Wait for Field change in Current Item. Do we have any similar action like this in Flow workflows.
Thanks, and Regards,
Deviprasad Shetty
There’s “do until”, which is the closest I can think of, that would make it wait for a specific thing/value.
Hello, this is a wonderful alternative to trigger flows in modern view! I have implemented it on one of my lists and it has been working just splendid! I have one small issue though that I can’t seem to figure out how to fix. When I am creating a new list item, even though I’ve hidden the ‘Action’ column in ‘Advanced Settings’ in the list settings, it’s not visible at first, however when I create a second list item, I see the action column in the form view. It seems like it’s being reset for some reason. Has anyone noticed any similar behavior and can assist with this issue?… Looking forward to a response…
Mine is weird sometimes, too. Seems random.
So it seems. However, it leaves the field open to the user who is filling out the form. I guess I can input some custom JS to have it hidden all the time, but, I try to avoid such customization because of how specific the reasons are…
Thank you for your response 😀
Hi Laura, this is a fantastic post, but I’m having the same problem: Please enter valid column-formatting JSON.
I’ve changed all quote marks, but can’t see any other issue. What else could be wrong?
Here’s the code again, I just copied it straight from a formatted column in SharePoint:
{
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”3fd1d970-0fea-496f-be53-5a8608b382ac\”}”
},
“style”: {
“background-color”: “purple”,
“color”: “white”,
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$_ModerationStatus]”,
“Pending”
]
},
“visible”,
“hidden”
]
}
}
}
If another user clicks on the button, then opens a form and the flow does not start ??
ok everyone must have authority on the flow …
Thanks! I went ahead and just added step 8, to add run-only users.
Hi Laura!
This helped me out a lot! Thanks! I just have one question. Do you know of a way of hiding the button if the user is not authorized to run the flow. I.e. the user is not in the “run-only” list.
No, I don’t think there’s a way.
I had this working perfectly. Then suddenly, yesterday, any views that had any JSON formatting on any columns stopped displaying in “new Experience”. I’ve had to delete all those columns to make my data visible again, or I have to swap back to classic which means I can’t use the buttons any more
I think MS have rolled out something that has broken this
I just looked at mine, and they’re still all there, just like I originally set them up. Not sure why yours did that. Same in all browsers?
Laura, Thanks so much for this! Since it’s possible to show/hide the button or link based on a column value, is it also possible to trigger two different Flows? So, let’s say there’s a status column with Approved/Rejected/Pending. If an item in Pending, I’d want to run a Flow called “Get Approval”; if it’s Rejected, I’d want to run another called “Submit Appeal”; and if it’s Approved, show nothing. I’m sure this is possible, but my skills (and patience) with json are lacking.
Yes, you can use Flow actions that trigger other flows. So, your button can trigger one Flow, and that Flow can have conditions in it, and each branch of the condition can have actions that start the other Flow(s). These are in the Flow category called ‘Flow Management’.
Can you hide the button for users who have no “run-only” access to the flow? Or maybe hide it from users lacking specific access to the list?
I can’t think of a way, but I don’t know that much about JSON. I know I could do it in a list of things (gallery) in PowerApps, but that’s totally different.
Hi Laura, thank you for the effort you put in teaching us these techniques. I have a question though.. Maybe you can advise.
We have a “Document Manager” who is responsible for the documents listed in a library. So everyone else, except for the Document Manager, has read only permissions for the items. But the Flow button then disappears. So I came across this article and was hoping to have found the solution to maintain the permissions (read only) and have a button to trigger a specific Flow.
But the button only works when the user has Any other permission than Read Only. Is there any other way to achieve this?
Well, that’s frustrating! It doesn’t surprise me. No, I don’t know of a way around that. Even when you add them as “run only” users of the Flow?
Yes even with Run Only user permissions. I continued my search and someone advised to give everyone full permission on site level and on library strip the permissions. That should be the workaround.
But it’s too much hassle to do that now, I’d have to recheck all sites, libraries etc etc if the permissions are still set correctly.
OH right, that’s what had to be done in classic mode, too. So, not new.
Hey Laura, is it possible for the execute flow button to work on a folder/ document set? I want to update the metadata on a document set, but am unable to get the flow to trigger.
I can’t find a way to do that, but I think Document Sets are going to get more love from Microsoft in the coming months, so maybe they’ll add that.
Hi Laura
It’s a very good post. It was very useful to me.
I would like to ask you if it is possible to display two different buttons for different Flow in one column, depending on eg the status of the document?
If the status of the document is “New”, then the “Send to approval” button should be displayed and to start some Flow.
And if the status of the document is “Approved”, then the “Finish” button should be displayed and to start other Flow.
And of course, for other statuses, nothing should appear in this column.
Best regards
Tomasz
Yes probably. I’ve never personally tried it, but I’m sure you could figure out the logic for that.
Hi Tomasz!
Yes it is possible. I have tried it with success. If you want only one button to be visible at a time then you will need to do though is to set the width of the first button to 0 in case the second button is visible. I have not made this in my test but it shouldn’t be a problem to add that as well.
{
“elmType”: “div”,
“children”:[
{
“elmType”: “button”,
“txtContent”: “Send for review”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”FLOW GUID\”}”
},
“style”: {
“background-color”: “#279bbf”,
“color”: “white”,
“border-radius”: “5px”,
“margin-top”: “5px”,
“padding”: “10px”,
“cursor”: “pointer”,
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “!=”,
“operands”: [
“[$axApprovedVersion]”,
“[$axCurrentVersion]”
]
},
“visible”,
“hidden”
]
}
}
},
{
“elmType”: “button”,
“txtContent”: “Send for approval”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”FLOW GUID\”}”
},
“style”: {
“background-color”: “#279bbf”,
“color”: “white”,
“border-radius”: “5px”,
“margin-top”: “5px”,
“padding”: “10px”,
“cursor”: “pointer”,
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$axApprovedVersion]”,
“[$axCurrentVersion]”
]
},
“visible”,
“hidden”
]
}
}
}
]
}
I’ve done something similar and it worked fine. Just be aware that in your example if the flow triggered by the “Send to approval” button changes the status of the document from “New” to “Approved”, then the user would need to refresh the page in between triggering the first flow and the second flow. This would make things pretty clunky and there is no current workaround for that.
Just extending the reply from Mattias – you can use the following styles properties to ensure the varying buttons being displayed appear inline with each other:
“position”:”absolute”,
“left”:”0″,
Hope that helps someone.
p.s. Laura – great post by the way!
As of the update on 3/27/19: When you evaluate the _ModerationStatus column it returns blank instead of “Pending”, “Approved”, or “Rejected”. This makes conditional formatting using the _ModerationStatus column impossible as far as I know. The workaround I used is to create another column that tracks approval status and use that for the conditional formatting of the button.
I don’t know if it’s applicable to this situation, but I was recently able to use the built-in moderation status column in a Get Items action filter in a Flow by using OData__ModerationStatus for the column name (note there are two underscores). Also, the values for the column aren’t Pending, Approved, Rejected, etc.; they’re numerical:
# Status
0 Approved
1 Rejected
2 Pending
3 Draft
4 Scheduled
Hi Laura, Just came across this post. Thanks for putting the effort into putting this together and sharing it. It was very helpful. Like other users I’ve been testing some things and two things I’m trying to figure out. One is that when you click on the button it brings up the “Run Flow” dialog making you click one more time to run the flow. Is there a way around this? The flow is triggered on “For a selected item”. The other thing is that I would like to make it so most users have read only access to the list but can run the flow. The test user has “Edit” access to the O365 group the list is in and “Read” access to the list itself. Even though I have the user added to the “Run Only” users group on the flow, it will not run the flow. Clicking on the button does nothing. Any suggestions?
Hi
Thank you very much for your article. Everything works really great!
I have a question concerning visibility: is it possible to make the visibility dependent on two other colums? – E.g.: If the approval Status is “pending” and Customer Status is “active” the button shall be visible.
Thank you
Peter
@Peter, indeed it is possible. I had a similar requirement and it took a while figuring it out but hopefully this helps you, and others. What you need to do is clear out the entire “visibility”: {…} section from Laura’s example and replace with something like this (I’ve guessed your internal columns names as approval Status = ‘ApprovalStatus’ and Customer Status = ‘CustomerStatus’):
“visibility”: “=if([$ApprovalStatus] == ‘pending’ && [$CustomerStatus] == ‘active’, ‘visible’,’hidden’)”
I’d appreciate it if you (and anyone else) could let me know if this has helped you.
Joe, How would you change the 2 conditions if you need both fields to not be blank?
Hi Laura, this is still the best flow article out there.
Do you know if it’s possible to actually run the flow when user clicks the button instead of opening the “Run flow” form? In cases when there’s no user input required, we just want flow to run right away.
No, I don’t know of a way to accomplish that, although it makes total sense.
Does anyone know why the column format tells me that the json is not correct ?? Do you have a right json?
If you copied and pasted the code from this post, you need to change the quotes (“) because what gets pasted from your copy is not a standard quote.
Hi Laura – this post opened my eyes. If I want to use the button to send an email, containing values from that particular row where I clicked the button, how would I do that? Right now, when I click the button, with the code you provided, an email is sent per row, from the sharepoint list. The possibilities though….. 🙂
Hi Mam,
Thank you very much for writing such a great article, i am able to create the same in my development environment.
just a simple question from my side, is there any Limitation for this button like it won’t work into the List view web-part?
Issue i am facing right now is Button click does not Triggers the Flow from the web-part as it Triggers inside the SharePoint list.
Please share your thoughts on it.
Nikhil, Did you ever figure this out? I am facing the same challenge that the button won’t initiate the Flow pop-out screen when exposed as a Web Part in a page.
This is a known bug that Microsoft is working on.
Hi Laura,
Thanks for the post! Can i run multiple flows at a given time using this method? The trigger of my flow is for a selected item and the out of the box method only lets you run one running flow at a time (madness Microsoft!)…
No, unfortunately, it doesn’t work the same way out-of-box. You’d have to do something extra like my post on creating a button in a list/library to run a flow, with conditional formatting so it doesn’t show if already running based on some status field you create.
This really helped me out and was super easy to understand and follow – thanks so much!
Esto solo funciona para ejecutar un flujo de Flow, de designer no?
Hi Laura, We have a classic SharePoint workflow which automatically gets an associated List Column to show the status of the workflow (“In Progress” or “Approved”, etc.) as it should.
The issue is trying to get the value from that workflow column within our Column Formatting code.
In your example you used the value from “[$_ModerationStatus]” to decide whether or not to show/hide the button, but seems as though I can’t do this when trying to reference the workflow column. I’m using the internal name of the column but doesn’t seem to get the value.
Using PnP PowerShell I can get the value. “Approved” is equal to 16.
Do you know if it’s possible to get this value (“Approved” or 16 – any value would be good enough), when using Column Formatting and a workflow generated column? That way I can only show my button when the workflow isn’t In Progress.
Sorry I’m not sure, I’ve never tried that. I would probably be poking around just like you, trying different things like “16”. There’s some other weird way I’ve seen that column formatted, like #!;Approved or something with weird characters in it like that.
Another great tutorial. I have a couple of questions.
1. How do I bypass the comment bit when clicked on the button so the flow just starts without the user knowing
2. Is it possible to bypass the Flow and change the value of another field from Pending to Approved (without Flow)?
1. Open up your Flow (flow.microsoft.com) and look at your trigger. Remove any “inputs” there. 2. Maybe with a calculated column?
Laura, I am interested in triggering a PowerApp (not flow) in the same manner. I would then like to use the PowerApp to manipulate the metadata on a document. Can you launch a PowerApp in a similar way and pass a handle to the document.
Sure, read April Dunham’s post, Open PowerApp using SharePoint Column Formatting. https://www.sharepointsiren.com/2019/03/open-powerapp-sharepoint-formatting/
Hello, I’m trying to have the button disappear after the button’s been clicked, but I’m not sure how to do that, do you think you could assist me? Also, I’m not sure what I should be replacing ‘moderation status’ with for my column.
I ended up designing a gallery in PowerApps with buttons.
To make it disappear after it’s been clicked, you’d have to use logic. So, when I run the Flow, the flow sets a certain status field value in the list, and then the button is only showing if the status is “not started”. Moderation Status is the build in field name (system name) for the out-of-box content approval column. (Content approval setting is in the list’s versioning settings screen).
Hi there, is it possible to hide the button based on the filetype? What I want to do is have different flows based on pdf, doc, xls, and even hide if it’s a folder. Can’t seem to find the internal column name for that.
Hi Sebastian, I would like to do the same thing as you. did you find the solution?
LIST OF INTERNAL NAMES FOR SHAREPOINT FIELDS : http://blog.softartisans.com/2009/12/08/list-of-internal-names-for-sharepoint-fields/
I did it. you have to add this for pdf files for example.
no need to consider folders, they do not have file extension :
“style”: {
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$File_x0020_Type]”,
“pdf”
]
},
“visible”,
“hidden”
]
}
}
Hi!
I have a problem regarding lanuage settings and the column [_ModerationStatus]. When formatting this column depending on it’s contents the language setting is an issue. Therefore the user browser language settings will make the column formatting fail. I would need to access the internal value for this column to make the formatting work in any language. Is there a way of accessing this value? I have tried the following: [_ModerationStatus.value] and [_ModerationStatus.id] unfortunately without any success.
Sorry I don’t know anything about the language settings or effect.
Hi, great post! But I’ve bumped into problem running flow mapped in button.
One of the first steps of flow is to get items from this document library where button is placed. I’m starting flow as my user who is owner of flow and connectors are up-to date. Error in flow:
InvalidTemplate. Unable to process template language expressions in action ‘Get_folder_metadata_using_path’ inputs at line ‘1’ and column ‘2028’: ‘The template language expression ‘json(decodeBase64(triggerOutputs().headers[‘X-MS-APIM-Tokens’]))[‘$connections’][‘shared_sharepointonline_1’][‘connectionId’]’ cannot be evaluated because property ‘X-MS-APIM-Tokens’ doesn’t exist, available properties are ‘Connection, Accept, Accept-Encoding, Accept-Language, Host, Referer, User-Agent, sec-fetch-mode, origin, sec-fetch-site, Content-Length, Content-Type’. Please see https://aka.ms/logicexpressions for usage details.’.
I’ve noticed that issue is connected to token handling. Seems like button is not providing user token to flow. Is it possible to pass some additional info from button to flow? Maybe something changed in platform itself.
Thanks
Solved! I’ve skanned your video with my colleague and problem was that we used Flows Manual button trigger not ‘For a selected item’ now it works and tokens are passed! Again awesome post!
Is it possible to use this steps on Task lists? I tried it and it is not working
“use this steps on task lists”? You mean put a button on a task list? Only if it’s a modern list. I don’t recommend using the “task” list template anymore.
Hi Laura – Given that you don’t recommend using the “task” list template anymore, are you able to recommend what to use instead?
I usually use just a custom list. In the list settings, you can click to add site columns, and quickly add other columns like due date, status, etc.
Hello,
This is very useful.
Can you please let me know if it is possible to pass a value to the Flow which is being triggered from the List. I would need to know and use the List item in the Flow on which the button has been clicked on.
Many thanks.
Yes. You can add input parameters to your Flow’s trigger.
Hi Laura, is it possible for the execute flow button to work on a folder , i am unable to get flow to trigger on Folder Button .
Ooh that’s a good question. I don’t know the answer to that. I’d try the “selected item” trigger and the “selected file” trigger, and maybe one or the other of those will work on a folder, not sure which one you already tried.
Hello Laura,
I followed the instructions and it did work pretty fine for my user. However when my team members clicks on the button, the Flow window comes up, but doesn’t load any information so they can execute the flow for that item.
The users were added as Run only users, and didn’t work. I have also added the users as Owners, also same issue.
Couldn’t find anywhere to check on other permissions.
Regards.
Does the flow work for them when they trigger it the regular way, not with this special button? If so, then the problem is not in the button.
Hello Laura,
Yes the flow works in the regylar way. I have also tried using different scripts (found over the internet), and same issue occurs.
Wow, that’s odd, I haven’t seen that happen. Have you tried it out on various browsers, to see if the results are different?
I created a button in a column so then when people click it, they can activate a flow that sends an email. Everything works for me (as the owner of the flow) but I realized, will it work for other people who are editors/owners of the SharePoint site to run the flow too? Or is there a special feature Microsoft requires me to pay for?
That’s the “run only users” thing that I mentioned in this post, at step 8.
I have used this in multiple SP sites but recently a user showed me that if we Search a list, we can’t kick off a Flow from an item in the search results even though the link is visible (nothing happens when clicked). The Flow button (in the toolbar area, if that’s the right term for it) is also missing if we do a search. Yet if we Sort or Filter, both work fine.
So our current work-around is to search, edit a field (to update the Modified date) and then go back to the same view and Sort the Modified column to show Newest on top. Then we can run the Flow.
Does anyone know if there is a better way to handle this?
Did you ever get an answer to fix the issue of flows not running after a search is performed ?.
No.
Did you find a fix for the search issue?
No
I did. Created a power app that runs the flow _quite easy
Hi Peter, their question had nothing to do with Power Apps. Their question was when you do a SharePoint search and are looking at the search results, can you make the button show there in the list of results. No, you can’t currently.
Hi All, We’ve recently come across this issue and I’m guessing there is still no work around for this?
No
Thanks Laura, This is valuable stuff. I too has the problems with quotes from your text (“ ” need to be “).
I cannot make it work when I use the List Webpart on a page I created. Pressing the button simply does nothing. Any ideas on how to make this work.
I modified it so the button text and action would change depending on a field in the list. I also used a different notation for the conditional statements (I forgot my reverse-Polish). Here format button column code (FYI):
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “button”,
“txtContent”: “=if([$NDA_x0020_Required]==’Yes’,’Request NDA Document’,’Get Document’)”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “=if([$NDA_x0020_Required]==’Yes’,'{\”id\”:\”e7a66c04-XXXX-409c-914b-036a6e27204a\”}’,'{\”id\”:\”bc17bfa5-XXXX-4b6a-b71d-3731b866117a\”}’)”
},
“style”: {
“background-color”: “green”,
“color”: “white”
}
}
@ Kevin Lynch, I discovered the same thing recently. There is a Uservoice idea for Microsoft to make Flow available inside webparts, but that was as far as I got!
https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/36709321-abilty-to-run-flow-from-library-list-webpart
I would also really need to be able to build solutions where you can run Flows from webparts and also from search results, which is also not possible today for some reason.
When you create a manually triggered Flow, when you add someone as a “run only” user, it sends them an email with a link to trigger the Flow. Take this link, and put it as a hyperlink in a web part as a button.
Hey Laura,
I also have the need to use my list with buttons in a List web part on a modern page. After following your advice, I did get an email to run the Flow with a “Get Button” button. However, since I want to allow the use of the buttons per list item, I am trying to figure out how would this work if the “Get Button” hyperlink exists as a single button on the web part… How is it going to target particular list items?
Not sure what you mean. This whole solution *is* based on the flow triggering per list item. It lists as a button per row of the list, as you can see in the screenshots.
Hi Kevin Lynch,
I want to do something similar with the part of your code:
“actionParams”: “=if([$NDA_x0020_Required]==’Yes’,'{\”id\”:\”e7a66c04-XXXX-409c-914b-036a6e27204a\”}’,'{\”id\”:\”bc17bfa5-XXXX-4b6a-b71d-3731b866117a\”}’)”
I would like to, if the value of the field is “Yes”, do nothing (button is clicked and nothing happens) and if the value of the field is no, or has no value (empty), run the Flow. I have very little experience in JSON but have everything working how i want it to except for this. Any help would be greatly appreciated!!
Thank you. Works perfect!
I have a problem with displaying values from columns that are not present in the current view. Is there something I have missed or is it not possible? I would like to configure one column to show values from several columns including a button to improve the user experience. I can build it and it works fine until I remove the other columns from the view.
Yes, I noticed this as well, although I don’t know a way around it.
@Mattias Have you tried View Formatting? https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting
Hi Jeremiah!
Yes, I have tried that as well. The columns (or a calculated column which refers to the columns somehow) still need to be in the view although they can be hidden with the view formatting.
Hello Laura, a great video, actually I want to ask you something, I have folders, subfolders, and documents in the subfolders, Can you share a way to create a view like that one that you have that gives me the number of documents that i have there.
For Example: Main view
Emea > Dicember > 2019> 7 files 7 files
US > October > 2019> 3 files 3 files
Hi Felipe!
There is already a column for that so you shouldn’t need any formatting. It is called “Item Child Count”.
Laura, Love the button. Stumbled on your elegant approach when trying to figure out something else. Namely the ability to launch a flow when the user searches for a record in the list as opposed to manually scrolly down to the find the record that they want to launch flow for. Flow option goes away on the menu when you get your search results. Your button works great for us, but apparently whatever turns it off for the menu when you go to the search result, it also turns off the functionality for your button launch the flow. Any insight on your part? Thanks,
No, I’m not sure about that one. We’ll see if they make any announcements this week at Ignite, that would indicate a smoother experience between the list custom columns and search results.
This button is really great. The users love it. How can the code be tweaked so that the button is visible if the field is Pending OR Rejected? I tried to play around in JSON but couldn’t get anything to work :/
Ended up finding a solution that helped me:
(Resource: https://techcommunity.microsoft.com/t5/SharePoint/Conditional-JSON-formatting-of-button-in-SharePoint-List/m-p/464400)
{
“elmType”: “button”,
“txtContent”: “Submit for Sign-off”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”987789d81-9008-4d2c-9833-74feff459a20\”}”
},
“style”: {
“background-color”: “#0070c0”,
“color”: “white”,
“visibility”: “=if(([$Sign_x002d_off_x0020_status] == ‘Pending’)||([$Sign_x002d_off_x0020_status] == ‘Rejected’),’visible’,’hidden’)”
}
}
Hi Laura, I’ve been using this setup for a while but recently the button has stopped working. I am no longer seeing the pop-up on the right hand side to trigger the flow. Has anything changed on the SP Online side that might have broken this functionality?
I don’t know, I recommend testing the flow by triggering it some other way. Mine in my environment still works fine.
Make sure that you use the correct flow id. I have missed changing this when I copy my code to other lists with other flows.
Ah, yes, one more thing. Make sure that you have shared the flow with the user who click on the button.
Hi Laura,
now it´s 2020 and this is still the best resource for a button. Great post!
I am looking into a little more customization and I failed… Could you give me a hint for the JSON to achieve the following:
I would like to have the text on the button change with the status column, that is referenced. And of course, I have more than 2 status options. So basically I would need a nested IF or whatever kind of Switch and then have the “txtContent” as part of that. The flow will stay the same.
Could you give some guidance here? Thanks!
Ugh, logic in JSON is super painful. I wish I could help you, but every time I try to do something like this, it takes me hours and hours to figure out.
If I understand you correctly I don’t think this would be very difficult. This code works fine for me. Adjust it to your needs and add more code for more status options.
{
“elmType”: “div”,
“txtContent”: “=if([$StatusColumn]==’A’, ‘Text is A’, if([$StatusColumn]==’B’, ‘Text is B’, ‘Neither A nor B is selected’))”
}
Help please – I dont know Json and I’ve tried to put together some formatting but although the hiding works I just have a small purple vertcal rectangle rather than a button with text. Any help appreciated
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “button”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”1234567made up GUID\”, \”headerText\”:\”Confirm you want to request this software\”,\”runFlowButtonText\”:\”Confirm Request\”}”
},
“style”: {
“background-color”: “purple”,
“color”: “white”,
“visibility”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“[$Status]”,
“Rejected”
]
},
“hidden”,
“visible”,
“children”,
[
{
“elmType”: “span”,
“txtContent”: “Request this software”
}
]
]
}
}
}
I would do it like this:
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “button”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”1234567made up GUID\”, \”headerText\”:\”Confirm you want to request this software\”,\”runFlowButtonText\”:\”Confirm Request\”}”
},
“style”: {
“background-color”: “purple”,
“color”: “white”,
“visibility”: “=if([$Status]==’Rejected’,’hidden’,’visible’)”
},
“txtContent”: “Request this software”
}
Hi Laura,
great job! Using this for all the lists with flow!
1 thing I’m still trying to solve, maybe you may have a hint.
On our tenant, when user clicks the button, the time between the button is clicked and the Flow Panel appears is something like 5+ seconds…
Do you think there’s any way to have spinner on the list during this action via JSON? So then, user clicks the button, sees the spinner on the list until the Flow panel appears?
Maybe it’s view formatting and not column formatting, i don’t know, my SP JSON capabilities are limited
thanks and have a great day
Karol
Hi Laura,
Thanks a lot for this post. Its very helpful.
It worked me perfectly.
I’ve a question? can we add same idea “A button to run a flow” in the display form for the selected item?
thanks
No, not currently.
Invalid JSON?
Why do i copy your JSON into a validator and it fails? Same thing in the JSON schema from the list formatting…..
I recommend re-typing it, and not copying/pasting. Some characters come across weird in the copy/paste.
Hi Laura,
Is there any way out where I can change the button shape size and color on the Mobile app when I am using it on widgets.
Because I have a couple of similar flow and similar buttons.
Help or Video is highly appreciated.
Thanks in advance
I’m not sure about the size and shape, but in the post I showed how to change it to purple. You can see the word “purple” in my code. Maybe for people who know CSS/styling, there’s a way, but I don’t really know code.
Hi Laura,
Learned a lot from your post. I actually started learning SharePoint only after reading this post, before that SharePoint was boring for me.
Thanks for making it interesting. 🙂
Also have a question:
What is the use of “$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”
i have used few codes without it, which also works, is there any special output this link gives or it is just there as any reference?
not sure about it, can you please help?
Shubh.
I have no idea, it’s just in all of Microsoft’s documentation. Cool if you figured out that it’s not needed, but I’m not sure what it’s for.
Hello Laura,
This is helpful information.
I would like to add the hidden and visible hyperlink feature to my code when the Status is “In Progress” and “Under Review”. How would I go about doing so?
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “button”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”72cf3e93-2e04-441a-a155-d0684e21f945\”}”
},
“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”: “6px”
}
},
{
“elmType”: “span”,
“txtContent”: “Send for Review”
}
]
}
Hi Maile, I covered how to do that yesterday during Power Hour, towards the end. https://youtu.be/0ZfOy0Jemd4?t=3544
Hi Laura,
I have a question
i have read your article about implementing a button to run the flow in share-point list and its working fine. However, when you search for an item in share point list and click on the button to run the flow, it does not do anything. Can you please help me with this
Multiple people have mentioned that here in the comments. Sorry, it’s a bug. Maybe Microsoft will fix it?
I’m also experiencing the issue that the button is no longer working when your perform a search. It’s no longer working due to the fact that the search result list doesn’t contain a menu that holds the Flow action. Without selecting a doc, there’s no menu at all. But even after selecting a doc on the results page, the standard menu options (like Open, Delete, Rename, Download, Share, Copy, Move, ..) are all there, yet Power Automate/Automate are NOT showing up. As such the reference to the corresponding Flow is missing > hence no action
Hello Laura! Great work!
Is there a way to make the button change color after it was clicked?
Hi Ron, I covered how to do something like that during Power Hour last week, towards the end. https://youtu.be/0ZfOy0Jemd4?t=3544
You’d have to make your flow set some field value in the list item, so then the condition for the button to be different would be based on that field value, like a status or something. But it wouldn’t be instantaneous, it would happen a few seconds later when the flow runs.
Hi Laura,
One question:
Every time we click button and run the flow, the input box pops up.
Is it possible to skip pressing the “Run flow” if we run a flow in SharePoint where there is no input to give?
Eliminating the step would make process faster.
Waiting for your ideas.
No.
Hi Laura,
Is it possible to change value of status column using this button without running flow?
Like, when i click the button the value of status column automatically change to submitted from requested. but there should not be any flow to do it. just using JSON.
Hope you understand my question.
Thanks
No.
Hi Laura,
This article is great – pointed me in the correct direction.
I have my flow running from a button if I am the owner.
If the account I am running is not allowed to run the flow nothing happens – I was hoping for a “you do not have permission” type message. Because at the moment the user will click it – and if they have no experience of running flows – will have thought that it has run.
Should I get that “you do not have permission ” type message ? – Is there any way of achieving it ?
Also can you use SharePoint groups to give permissions – not just AD security groups ?
Hi Cathrine!
You can chose to hide the button if the logged in user is not permitted. just add this if-formula.
“style”: {
“display”: “=if(@me == ‘myemail@mydomain.com’, ‘none’, ‘block’)”
}
They can still run the flow from the Automation menu though. If they do you can then build in a test in the flow to check if the user is valid and then e-mail them an error message.
I hope this will help. Have a nice day!
Hi, Laura. Thanks for maintaining this wonderful site! It’s really helping me get up to speed with Power stuff.
I was able to implement your link-and-icon solution on my own list. Even customized it a little. I have two issues with it, though – and it’s not because of your code. First, users have to click a Run App button every time. Second, the changes cannot be seen without manually refreshing the screen.
Is there any way around these inconveniences?
Thanks again for you help!
Sorry, I don’t know of a way around those.
Hi Laura,
I was wondering if there is a way to make a clickable button to go to a folder in a documents library? The problem i have is each list item has its own folder i need to direct it to in the document library.
You could add a hyperlink column to your SharePoint list, and put the link to each folder directly in there.
Hi Laura,
If we use this on a document library which is used in MS Teams, you can see the button in Teams, but if you click on it, nothing happens. Do you have a solution for this?
Regards,
Raphael
No, I don’t know of a solution. Hopefully they will fix it soon, though.
Really well explained, thanks to this solution, I am able to put buttons to my sharepoint list, that too with conditions. Thanks for sharing
Hi! I really like this solution but I was wondering if there was a way to get the button to submit the actual “approve” response once clicked.
I have a list that I use as a check list. Every time a new item populates, I want to have the button there so that I can “one click” and it sends the “approved” or “reviewed” response to the flow. No page changes, no comment box, just a button that sends the response.
If you were using a Power App and not going to the list, you could easily do that with a gallery and a Patch function. But no, not in the list in the browser.
Thank you laura for your post. That helped me a lot in implementing a requirement. Now Microsoft has published the gallery view in lists on SharePoint. Is it possible to include a button with “flow action” there too?
You can create your own formatting for a view, and make it do/look however you’d like. So you can create your own “gallery” type of view. I recommend checking out these samples that you can download: https://github.com/pnp/sp-dev-list-formatting/tree/master/column-samples
Hi Laura,
Nice to read this all.
Can you tell if (and how) it is possible to create a button on a modern SharePoint site to start a Flow (that has been defined as a button flow with manual input)?
Yes, but it just wouldn’t be on each item in a list or library. When you share a flow with someone as a run-only user, the email it sends has the link to directly trigger the flow, and then you can use that link on a button on your site or anywhere.
Thank you Laura! That did the trick, and we gonna use it.
Hi Laura, i have this deployed in a few places and its very helpful. The one thing that has come up a few times in policies is that it would be nice to either disable or change the colour of the button for that specific user only once they’ve excuted the flow once. Is that possible ?
Sure, you could use logic in the flow to set some field value in SharePoint, like call it status or something. Then, you’d have to figure out the JSON logic to show a different color per value of that status field.
Hi Laura, there is something frustrating invoking a flow; it is the fact you have to confirm the action even you do not have parameters to send to the flow. If you have to press on several buttons in the list then you have also to click on “run flow” several times as well.
Is there a way so skip this stupid step?
No.
Hi
Thanks for your post, your code.
I would like to adapt your code.
Every line/buttom will launch its own flow .
So I have your code and a column called IdFlow who contains the ID of the flow.
But it doesn’t work, I tried with calculated column too and it’s the same :” Sorry, something went wrong”
Any idea?
Magali
={
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “button”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”[IdFlow]\”}”
},
“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”: “6px”
}
},
{
“elmType”: “span”,
“txtContent”: “Start the Automate”
}
]
}
Thank you so much Laura. This has really blown the lid off my List/Flow ceiling. I’m very grateful.
What do you think about adding a condition so the column shows different buttons (either just text running the same Flow or actually different Flows) depending on the status of another column?
Pingback: How to show the folder path of a file in library views – SharePoint Stuff
Greetings Laura!
First thank You for great post!
Also thank You for post about tabbed forms, really really helped.
What do You think about button in Search Results? I created a bug about it:
https://github.com/pnp/sp-dev-list-formatting/issues/302
Strange that these executeFlow buttons do not fire for items returned from Search Results..
Best regards,
Gennady
How to add input parameters to your Flow’s trigger.(send logged in user name as input parameter to flow)
Sure, you can send a query string to a Power App as a parameter. I have a detailed, hour long explanation and demonstration of that process, in my Advanced Power Apps course online: https://www.iwmentor.com/bundles/all-powerapps
Fantastic post, thank you. Does this approach only apply to Flows saved in the ‘default’ environment? My company has forced us to create Flows in a different (non-default) environment. Consequently, I can’t use a “for selected item” sharepoint trigger. I imagine that simply copying the GUID as you describe above would not work correctly?
Hi Lisa, I’m not sure, I’ve never tried it. I recommend just trying it out to see if it would work.
Hi Lisa,
Really love this. With the visibility statement is there a way to have 2 values? Like IF Moderation status = “S” or “E”?
Thanks
Hi Robin, “IF” conditions are…. interesting in JSON. I’m sure there’s a way to do it, but I just don’t know the syntax.
Robin, I think I know what you’re asking. I did something similar a couple years ago for a project planning “board” using a List and some Flows.
My apologies for the older JSON formatting syntax (the new Excel style is much more condensed and easier to read), but this one still works so I haven’t touched it. You can probably pick out the 4 possible status conditions (Planned, Eliminated, Approval Requested, and Approved). Either of those first 2 resulted in showing a button to Submit or Re-Submit the project for approval which fired off a Flow (the same flow for our process, but could be different flows). Just swap out your field name, conditions and flow IDs, and remove the sections you don’t need.
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json”,
“elmType”: “span”,
“style”: {
“color”: “#009ada”
},
“children”: [
{
“elmType”: “button”,
“style”: {
“border”: “none”,
“background-color”: “transparent”,
“color”: “#009ada”,
“cursor”: “pointer”,
“display”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“Planned”,
“[$Status]”
]
},
“”,
“none”
]
}
},
“txtContent”: “Submit for Approval”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”f22dd696-5da9-4ccf-b0dd-6871da1e177a\”}”
}
},
{
“elmType”: “button”,
“style”: {
“border”: “none”,
“background-color”: “transparent”,
“color”: “#009ada”,
“cursor”: “pointer”,
“display”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“Eliminated”,
“[$Status]”
]
},
“”,
“none”
]
}
},
“txtContent”: “Re-Submit for Approval”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”f22dd696-5da9-4ccf-b0dd-6871da1e177a\”}”
}
},
{
“elmType”: “a”,
“style”: {
“font-weight”: “bold”,
“display”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“Approval Requested”,
“[$Status]”
]
},
“”,
“none”
]
}
},
“txtContent”: “@currentField”
},
{
“elmType”: “a”,
“style”: {
“display”: {
“operator”: “?”,
“operands”: [
{
“operator”: “==”,
“operands”: [
“Approved”,
“[$Status]”
]
},
“”,
“none”
]
}
},
“txtContent”: “”
}
]
}
Pingback: SharePoint: How To Build Buttons – Real Men Wear Spandex
Hi Laura,
a giant thank you for these explanation that helped me to improve my Sharepoint List.
Unfortunately, if it is working perfectly for me, my colleagues that should have authorization to run the flow do not see the flow on the right pan. When they click on the button, nothing appears on the right, it is like the flow does not exist for them but with my user no problem !
I have given to my users E3 licence and I have added them to Run-Only Users in my flow. I don’t know what to do more !
Try different browsers and see if that’s the issue? Also, have them try clicking the Power Automate button in the list and triggering it that way, to see if they’re able to do that. That way, you’ll know if the problem is with the button or with the flow itself.
Finally, I have found the problem. There are a lot to know about Sharepoint List and Power Automate authorizations !
Here are what I have must done to let my users access a poor manual flow on the list:
1) give them an E3 O365 licence
2) give them “Execute only” authorization on my flow using sharepoint members list
3) give them back the autorization to Manage the sharepoint list and to Add new item !
The last point seems to be very important, it is a bit pity that we must do that. Consequently, my users can add new columns or do what they want on the list ! Crazy !
I only ever use E1, so they don’t need E3 to be able to do this. Also, I’ve never had to do what you’re referring to in step 2.
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
“elmType”: “div”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”811ca48a-d1b9-4eec-a47e-f31fcc86a0d3\”}”
},
“attributes”: {
“class”: “ms-fontColor-themePrimary ms-fontColor-themeDarker–hover”
},
“style”: {
“border”: “none”,
“background-color”: “transparent”,
“cursor”: “pointer”
},
“children”: [
{
“elmType”: “span”,
“attributes”: {
“iconName”: “car”
},
“style”: {
“padding-right”: “6px”
}
},
{
“elmType”: “button”,
“txtContent”: “Send Pick Up Request”
}
]
}
Hi – Thanks for this really helpful tutorial.
Is it possible to trigger a flow via a button from a custom SP List Edit from? I would like to create a button inside of my custom edit form that when pressed, kicks off the flow, much like you have demonstrated here, except it’s in the custom form. I tried creating this field in the list, then creating a button in the Edit form to essentially press the button in the list, but have had no luck. Any help would be greatly appreciated!
Disregard this – I’ve been struggling with this for a week straight and finally managed to figure it out 10 minutes after submitting this comment.
Laura,
Is there a way for the buttons to be hidden unless someone selects the item. I have some people who think it would be more pleasing to the eye if the buttons were not visible all the time. I do have a visible check for if the Workflow has already been triggered already and they want that still as well.
I don’t know, maybe something could be done in the JSON code regarding the onhover? I’m not a dev, so I don’t know what the code would be.
Hi Laura! I used this great feature you shared in this post, but I’m struggling with the Column ID. The button remains “hidden” beacause of that. My column is called “¿Es alerta médica?”… Any thoughts?
I recommend creating a column name that is very simple, with no spaces or strange characters, a brand new one.
Hi Laura, is there a way to get the button to execute from a gallery view. I have tried so many different custom formatting and searched high and low for videos or blogs about this but can’t seem to find anything. I can get the button on the gallery view but when you click it, nothing happens. It works fine from the list view.
oh that’s a good point, sorry I’ve never tried it but that doesn’t surprise me.
Hi, Laura; Awesome tip! I use this a lot.
One thing: the quotation marks in your code snips are using a non-standard font and need to be replaced when I copy and paste the code. So I have to manually replace all the quotes with standard quotation marks.