1

I set up column color coding based on the Due Date, but I want to extend that to the entire row.

  • If the due date is within 30 days, the color is red.
  • If the due date is within 60 days, the color is orange.
  • If the due date is within 90 days, the color is yellow.
  • Anything over 90 days, the color is green.

When I use the code below, it highlights my entire table.

{"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json","additionalRowClass": "=if([$DueDate] == @now,'',if([$DueDate] < @now, 'sp-css-backgroundColor-BgCoral',if([$DueDate] <= @now +  2592000000,'sp-css-backgroundColor-yellow',if([$DueDate] <= @now + 7776000000,'sp-css-backgroundColor-BgGold','sp-css-backgroundColor-BgMintGreen'))))"}

1 Answer 1

1

Try using JSON like below in view formatting:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "additionalRowClass": "=if(Number([$DateColumn])==0,'',if([$DateColumn]>addDays(@now,90),'sp-css-backgroundColor-BgMintGreen',if([$DateColumn]>addDays(@now,60)&&[$DateColumn]<=addDays(@now,90),'sp-css-backgroundColor-yellow',if([$DateColumn]>addDays(@now,30)&&[$DateColumn]<=addDays(@now,60),'sp-css-backgroundColor-BgGold','sp-css-backgroundColor-BgCoral'))))"
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.