Forum Discussion
SLCLARKE23
Mar 25, 2022Copper Contributor
Conditional Formatting in Sharepoint List based on expiry date within 30 days
I currently have a list which shows training. the box shades red when the training has expired and is green when it is active. I would like it to go Orange when the training is going to expire in the...
RobElliott
Mar 25, 2022Silver Contributor
SLCLARKE23 dates in JSON use milliseconds. So 60 days is 5184000000 milliseconds:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField > @now+5184000000, 'green', if(@currentField > @now && @currentField < @now+5184000000, 'orange', 'red')",
"color": "white"
}
}
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
SOE_Tech
Feb 21, 2023Brass Contributor
Can i be so bold and ask how to to "nothing" if the current field is empty?
With the current JSON the empty fields get red as well
With the current JSON the empty fields get red as well