Forum Discussion
Column formatting - Last Review Date + 365 days
- Aug 11, 2022
Chris Cundy Yes, you have to add one more condition in expression like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if(if(Number([$LastReviewDate]) == 0, 'ms-bgColor-yellowLight', [$LastReviewDate] + 31536000000 <= @now , 'ms-bgColor-red ms-fontColor-white', ''))" }
Reference: SharePoint JSON formatting: Check if date & time column is blank/empty
Output:
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.
For coloring only last review date column, you can use column formatting. use this JSON in "Format this column" option for date column:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "=if(@currentField + 31536000000 <= @now , 'ms-bgColor-red ms-fontColor-white', '')"
}
}
Output:
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.
Both the above options for row and column formatting work well - are you able to help with my second query?
Can we highlight rows where the Last Review Date is empty? in a different colour such as yellow?
and can this be incorporated to the first solution?