Conditional formatting - only show button if attachments are present

Copper Contributor

Hi,

 

I am trying to only show a button in a column, if there is an attachment present in the same row on the attachment column.

 

Here is what I have so far:

 

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Send Offer",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"f191e7c8-1a36-4553-9d64-607764fc6f83\"}"
},
"style": {
"background-color": "blue",
"color": "white",
"visibility": "=if(([$Attachments] == false),'visible','hidden')"
}
}

 

I have tried changing " [$Attachments] == false) " to equals true, 1 and 0, and there's still no use. If I look into the address bar I can see " FilterField1=Attachments&FilterValue1=1 ", but even when I enter "1" as the value the button still does not display when attachments are present.

Any help is highly appreciated.

Thank you!

1 Reply
"txtContent": "=if([$Attachments] == '0', 'no attachment', 'item has attachment')"