locked
Sharepoint JSON row formatting issue with yes/no column. RRS feed

  • Question

  • Hello,

    Fairly new to Sharepoint and very new to using JSON, so apologies if this is a daft question...

    I have a modern Sharepoint list which has within it a Yes/No column (which is called "Available") and I want to highlight the entire row based on this. I have found a sample bit of JSON code: 

    {
      "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
      "additionalRowClass": "=if([$Status] == 'Done', 'sp-field-severity--good', if([$Status] == 'In progress', 'sp-field-severity--low' ,if([$Status] == 'In review','sp-field-severity--warning', if([$Status] == 'Blocked','sp-field-severity--blocked', ''))))"
    }



    I have tested this by adding in a Status column setting the value to 'Blocked' and it works fine, but I can't seem to make it work for my Yes/No column and I don't understand why. I modified the code to this: 

    {
    
      "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
      "additionalRowClass": "=if([$Available], 'sp-field-severity--good','sp-field-severity--blocked')"
    
    }



    But it doesn't work.   What have I done wrong? 

    Thanks in advance! 

    James
    Thursday, November 21, 2019 12:54 PM

All replies

  • Maybe you should write “=if([$Available]==’Yes’, …”.

    Thursday, November 21, 2019 5:37 PM
  • Maybe you should write “=if([$Available]==’Yes’, …”.

    I tried that originally, but that doesn't work either unfortunately.  Thanks though! 
    Friday, November 22, 2019 10:39 AM