Forum Discussion
misce
Aug 13, 2020Copper Contributor
Conditional Format SharePoint List Due Dates with three conditions - RAG
I've tried searching for this seemingly everywhere and although there's lots of people with similar problems I've not found someone with this exact one and therefore this answer. Apologies if it is a...
- Mar 24, 2021
misce I was recently looking for a similar resource myself. If you are still in need, this code should work for you. If you don't like the exact RAG colors, you can easily replace the them with a different HEX (here is a great site for picking colors: https://hexcolor.co/color-picker)
{"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json","elmType": "div","txtContent": "@currentField","style": {"background-color": "=if(Number(@currentField) == 0, '', if(@currentField >= @now + 2592000000, '#AFF8C9', if(@currentField >= @now + 86400000, '#EEBB2F', if(@currentField <= @now, '#F06C47',''))))"}}
TKLR_83
Mar 24, 2021Copper Contributor
misce I was recently looking for a similar resource myself. If you are still in need, this code should work for you. If you don't like the exact RAG colors, you can easily replace the them with a different HEX (here is a great site for picking colors: https://hexcolor.co/color-picker)
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(Number(@currentField) == 0, '', if(@currentField >= @now + 2592000000, '#AFF8C9', if(@currentField >= @now + 86400000, '#EEBB2F', if(@currentField <= @now, '#F06C47',''))))"
}
}
misce
Apr 21, 2021Copper Contributor
Unfortunately I can't get this to work, but I'm going to mark it as correct as it has for someone else so it must just be something I'm doing wrong!
A couple of questions I guess, 1) do I replace @currentField with the name of the column or can I just leave it as that?
I think on second thoughts that my problem may be that the column is a Single Line of Text column, because it's getting data from a PowerApp that was easier at the time, so I'm not sure if it will be possible to do what I wanted anyway.
Thanks for your response!
A couple of questions I guess, 1) do I replace @currentField with the name of the column or can I just leave it as that?
I think on second thoughts that my problem may be that the column is a Single Line of Text column, because it's getting data from a PowerApp that was easier at the time, so I'm not sure if it will be possible to do what I wanted anyway.
Thanks for your response!