SOLVED

JSON change color of row based on date column

Copper Contributor

I am looking for a JSON code that changes de color of the ROW to red if it is 200 days after the date of a column.

So the column says 10/12/2022 (dd/mm/jjjj)
And if it today 200 days after that date, the color of the whole row must be read.

 

I have searched a lot but cannot find some based on the date of a column.

 

Please is there somebody who can help me?

 

Rense

3 Replies
I tried this code but it doesn't work.
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Modified] < @now && [$Modified] >= @now + 172800000, 'sp-field-severity--blocked', if([$Modified] < @now && [$Modified] >= @now - 86400000, 'sp-field-severity--warning' , ''))"
}

The color must be yellow from 190 day after the checked date.
And after 200 days it must be red for ever till the document is checked and the date is changed.
best response confirmed by Rense620 (Copper Contributor)
Solution

@Rense620 Use JSON view formatting code like below:

 

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

 

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.

That did the trick!
First I made a little typo... :)
Thank you very much for you help!

1 best response

Accepted Solutions
best response confirmed by Rense620 (Copper Contributor)
Solution

@Rense620 Use JSON view formatting code like below:

 

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

 

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.

View solution in original post