Forum Discussion
Create a button in sharepoint Online
- Nov 28, 2018I'm fairly certain you can't just click a button to update a field in modern UI right in line in the list, hence why people put buttons for flows to do some action. You need to create your own flow with the logic you want to happen when clicking that button. Once that's done and working by using the Flow Drop down menu for "Selected Item" then you can use the Column Formatter to add a shortcut / Button to that flow and use the ID from the flow etc.
https://www.youtube.com/watch?v=C-oLlVtRrUk
Thank you Chris, Although this link is referred about the MS flows , while I need just to change the status of a specific field by clicking a button.
I tried also to follow the video(Laura) with trigger MS flow but it doesn't work, please see below the json code.
ere is the json :
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”4f74601c-6756-43b1-bfed-914a1fc5b321\”}”
},
“style”: {
“background-color”: “purple“,
“color”: “white”
}}
Can you please advise..
Thank you
- Nov 28, 2018I'm fairly certain you can't just click a button to update a field in modern UI right in line in the list, hence why people put buttons for flows to do some action. You need to create your own flow with the logic you want to happen when clicking that button. Once that's done and working by using the Flow Drop down menu for "Selected Item" then you can use the Column Formatter to add a shortcut / Button to that flow and use the ID from the flow etc.
- edok1280Nov 28, 2018Copper Contributor
Thank you Chris.
I have already done that , but unfortunately it doesn't work.. It works OK by using the Flow Drop down menu for "Selected Item" .
Can you please check the Json formatting, it says that there is error...
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
“elmType”: “button”,
“txtContent”: “Get Approved”,
“customRowAction”: {
“action”: “executeFlow”,
“actionParams”: “{\”id\”: \”4f74601c-6756-43b1-bfed-914a1fc5b321\”}”
},
“style”: {
“background-color”: “purple“,
“color”: “white”
}}Thank you
- JK47Jan 27, 2022Copper ContributorI followed Laura's documentation but the copy/paste of JSON code wasn't recognised.
Laura made a comment down the bottom that this sometimes happens, and to type the code out yourself. I did a find/replace on all the special charactors, and this fixed it. My code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Publish",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"50022e3e-c14c-4c5c-8057-f215148f6b3f\"}"
},
"style": {
"background-color": "purple",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$Status]",
"Requires Review"
]
},
"visible",
"hidden"
]
}
}
}
I know it's 3 years too late, but this might still help you, and others 🙂