SPO List Conditional Formatting

New Contributor

This should be relatively easy, but we just can't seem to get this working properly. We have a column in an SPO list with a date of assignment [AssignedDate]. All we want to do is highlight a row if that date is within 30 days of @now...but no examples we've used, or tweaks we've done, seem to work. Sometimes nothing highlights, and sometimes everything. Does anyone of a working example of similar JSON just so I can compare and see what we might be doing wrong?

3 Replies

@UBTech3812 Try using view formatting JSON something like: 

 

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

 

Output

ganeshsanap_0-1670603142875.png

You can change the number of days and class in JSON as per your requirements.

 

Documentationview-list-formatting 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap Same result. No rows highlight, despite numerous having assigned dates this month. I am not sure what's going on exactly. No errors... it just doesn't work if we try to use a relative date.

 

The only thing that seems to do ok is using design mode to create a rule for between a specific fixed date and @now.... but we need that date to be relative between now and 30 days before.

@UBTech3812 Can you add the screenshot of your list view for sample data? Also add screenshot where you are adding the above JSON I provided.


Please consider giving a Like if my post helped you in any way.