Forum Discussion

Stanislawo's avatar
Stanislawo
Copper Contributor
Aug 23, 2022

SharePoint Json If statement for visibility based on Other Colums being empty/ filled

I've been trying to create a SharePoint list in which a button is visible when two of the columns of that row have a value entered. I've tried looking for answers but can't find anything that has worked.

I'm trying to check that the column name Approvers for that item is not empty (for which I'm trying to check that it is not equal to null). Ideally I would like to check that Sender is not null but any help would be appreciated. Here's what my JSON file looks like:

 

{
"elmType": "button",
"txtContent": "Send",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"9de29813-f1b8-4ebc-870e-fe3a7a4472af\"}"
},
"style": {
"background-color": "purple",
"color": "white",
"visibility": "=if([$Approvers] == \"\" ,'hidden','visible')"
}
}

As you can see the approvers field doesn't change the visibility. Any help would be much appreciated!!

 
  • Stanislawo 

    "visibility": "=if([$Approver] == '' && [$Sender]=='' && Number([$Deadline]) == 0 ,'hidden','visible')"
     
    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Stanislawo "visibility": "=if([$Approvers] == '' ,'hidden','visible')" where the =='' uses single quotes.

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

    • Stanislawo's avatar
      Stanislawo
      Copper Contributor
      Thank you so much!! I'm a bit gutted that I didn't try that, do you know how I could incoroporate an and statement into the if statement? Exact same thing but for another column called senders.
      • RobElliott's avatar
        RobElliott
        Silver Contributor

        Stanislawo just add && [$Senders]=='' for and or use pipes || for or

         

        Rob
        Los Gallardos
        Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Resources