Forum Discussion
edok1280
Nov 28, 2018Copper Contributor
Create a button in sharepoint Online
Hi, I need to add a button (as seperate column) in my Sharepoint Online list which will be visible when another column "Approval Status" has 'Pending' value and then when I click this button will ...
- 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.
edok1280
Copper 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
JK47
Jan 27, 2022Copper Contributor
I 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 🙂
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 🙂