Jun 24 2020 08:36 AM
In my Sharepoint List, I want to hide a button if the user hasn't entered an address. The field is a Location field called "Address" and I cannot get the syntax correct. The JSON code extract is below (and for the avoidance of any doubt, the first part of the IF statement works fine.)
I have tried $Address.Name, $Address.Street, $Address.value ... I just can't seem to get it
"visibility": "=if([$RTWVALIDATERef] == '' || [$Address] == '','hidden','visible')"
Any help would be greatly appreciated.
Jun 24 2020 10:29 AM
Solution@GeoffersThere is no direct way but you can always use a workaround. Like shown below
Step 1: Create a Calculated Column And add the formula which checks the Address is empty or not. Like shown below: (I am making sure address should have a postal code)
Step2: Then use that column to check if the Address is present then show or hide the button on the basis of Calculated column.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"style": {
"color": "#0078d7",
"background-color": "White",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$CheckAddress]",
"Present"
]
},
"visible",
"hidden"
]
}
},
"children": [
{
"elmType": "span"
},
{
"elmType": "button",
"txtContent": "Send Mail",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"e290feff-0013-41f2-97dd-91a37fb84ea0\"}"
}
}
]
}
Vik
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jun 25 2020 12:03 AM
Thank you for this solution. It works perfectly. I have added more address fields to the formula to make for a more robust check but the principle is exactly as you have outlined. My formula is
=IF(AND(ISBLANK([Address: Postal Code]),ISBLANK([Address: Street]),ISBLANK([Address: Name])),"Empty","Present")
Jun 24 2020 10:29 AM
Solution@GeoffersThere is no direct way but you can always use a workaround. Like shown below
Step 1: Create a Calculated Column And add the formula which checks the Address is empty or not. Like shown below: (I am making sure address should have a postal code)
Step2: Then use that column to check if the Address is present then show or hide the button on the basis of Calculated column.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"style": {
"color": "#0078d7",
"background-color": "White",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$CheckAddress]",
"Present"
]
},
"visible",
"hidden"
]
}
},
"children": [
{
"elmType": "span"
},
{
"elmType": "button",
"txtContent": "Send Mail",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"e290feff-0013-41f2-97dd-91a37fb84ea0\"}"
}
}
]
}
Vik
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.