Forum Discussion

Steve_Ray's avatar
Steve_Ray
Copper Contributor
May 04, 2022
Solved

Conditional Formatting Document Review Dates

Hi All,

 

I am reletavley new to using Sharepoint online and list and i have a listi need help with.

 

My list tracks a number of operational procedures which are required to be reviewed on a regular basis.

 

To allow for work planning I would like to format the list so that is highlights items when they are approaching there review date.

 

Next Review DateCondition
01/01/2022Already overdue (highlight in Red)
06/06/2022Due for review in the next 6 months (Highlight in Orange) 
15/12/2022Due for review in the next 12 months (Highlight in Green)
06/06/2023Due for Review in more than 12 months (Leave White)

 

Thanks in Advance

 

Steve

  • Steve_Ray you can do this by formatting the column, selecting advanced mode and adding the JSON below. Note that date comparisons in JSON are done in milliseconds and I use the converter at https://convertlive.com/u/convert/months/to/milliseconds#12

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(@currentField <@now , '#c00000', if(@currentField >@now && @currentField <@now+15552000000, 'orange',if(@currentField > @now+15552000000 && @currentField < @now+31557600000, 'teal',' ')))",
    	"color": "=if(@currentField <@now+31557600000, 'white','#363636')"
      }
    }

     

    The result is as follows:

     

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

     

     

     

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Steve_Ray you can do this by formatting the column, selecting advanced mode and adding the JSON below. Note that date comparisons in JSON are done in milliseconds and I use the converter at https://convertlive.com/u/convert/months/to/milliseconds#12

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(@currentField <@now , '#c00000', if(@currentField >@now && @currentField <@now+15552000000, 'orange',if(@currentField > @now+15552000000 && @currentField < @now+31557600000, 'teal',' ')))",
    	"color": "=if(@currentField <@now+31557600000, 'white','#363636')"
      }
    }

     

    The result is as follows:

     

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

     

     

     

Resources