Forum Discussion

cyberco20's avatar
cyberco20
Copper Contributor
May 05, 2020
Solved

JSON code to change color of Name of Folder in Sharepoint Online

Dears, Kindly help me with the JSON code so that the color of rows in Name column is red. I have achieved similarly in the Folder Child Count, however I am unable to do in Name column. I want the ...
  • Beau Cameron's avatar
    May 05, 2020

    cyberco20 What have you tried so far? You should be able to apply a very similar column formatting rule to your Name column, except you will want to reference the FolderChildCount column.

    To reference that column, you would use the following syntax [$ColumnName]. So in this example, you would use [$FolderChildCount]

    An example would be something like this:

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "attributes": {
    "class": "=if([$FolderChildCount] != '0','sp-field-severity--severeWarning', '')"
    }
    }

Resources