Forum Discussion
Peter_K
Apr 17, 2019Copper Contributor
Conditional JSON formatting of button in SharePoint List
Hi everybody I am looking for a solution for a formatting problem in one of my sharepoint columns. In one column I have a button which triggers a flow. I am aiming for a visability of the ...
- Apr 18, 2019
{
"elmType": "button",
"txtContent": "Get Approved",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\":\"86dfdf10-8d99-4914-8e98-fe4b21ed7e34\"}"
},
"style": {
"background-color": "purple",
"color": "white",
"visibility": "=if(([$ModerationStatus] == 'Pending') && ([$DocumentType] == 'Offer'),'visible','hidden')"
}}
check this sample .. I got rid of the Operator and used a simple if statement. only change to visibility property.
RobElliott
Jun 20, 2021Silver Contributor
rolanddaane your if statement on the visibility line is the wrong way round, it should be:
"visibility": "=if(([$ShareBim360] == 'Yes'),'visible', 'hidden')"
Rob
Los Gallardos
Intranet, SharePoint, Website and Power Platform Manager (and classic 1967 Morris Traveller driver)
rolanddaane
Jun 20, 2021Copper Contributor
Hi mate, thanks!
I took an example of yours, and I really like the buttons!
If I use the below the buttons shoe on no line, even if the value of ShareBim360 contains Yes
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Share to Bim360",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"bce75e04-998b-4600-b829-7370d6a2ee15\",\"headerText\":\"All Things REI\",\"runFlowButtonText\":\"Publish Now\"}"
},
"style": {
"background-color": "#008082",
"color": "white",
"border-radius": "0 15px",
"visibility": "=if(([$ShareBim360] == 'Yes'),'visible', 'hidden')"
}
}
I took an example of yours, and I really like the buttons!
If I use the below the buttons shoe on no line, even if the value of ShareBim360 contains Yes
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Share to Bim360",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"bce75e04-998b-4600-b829-7370d6a2ee15\",\"headerText\":\"All Things REI\",\"runFlowButtonText\":\"Publish Now\"}"
},
"style": {
"background-color": "#008082",
"color": "white",
"border-radius": "0 15px",
"visibility": "=if(([$ShareBim360] == 'Yes'),'visible', 'hidden')"
}
}