JSON to format rows in SharePoint List

Copper Contributor

Hi all,

Firstly thank you in advance for any help anyone can provide on this, it's greatly appreciated.  

I thought this would be a simple one however I just can't understand why it's not working.  I'm new to JSON and it's just not going in my head at the moment.

 

I have a large SharePoint list which list tools that require calibration.  I would like to make rows highlight red if they've missed their calibration, (which I can get to work using the wizard), and also make them highlight yellow if they're a month away from calibration, (which I can't do).  The wizard does not support this second option, so I have to head to JSON.

 

Going from Microsoft instructions (Use view formatting to customize SharePoint | Microsoft Docs) I should be able to use this to make it work, however, if I use it, it turns everything red, unlike the wizard which did at least get the overdue items correct:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
   "additionalRowClass": "=if([$Next_x0020_Calibration_x0020_Date] <= @now, 'sp-field-severity--severeWarning', '')"
}

 

So in a nutshell, why would this turn everything red, when it shouldn't, I'm guessing it could be something data/time format related or the fact that the 'Next Calibration Date' field is a calculated field, but again it did work the the wizard - and secondly, how could I add another rule to this that'll make items yellow if they're a month away from calibration?

 

Once again thank you for any help that anyone can offer.  It looks to me like it should be simple, but my head is starting to explode from reading tutorials and not getting anywhere with it. 

 

Thank you again.

0 Replies