Forum Discussion
as733y
Apr 04, 2024Copper Contributor
Sharepint List Column Formatting
Hi, I'm trying to format my General_x0020_Outlook_x0020_incl column to apply the formatting if the date in the column is within the next 45 day. I think I'm really close with the below JSON, ...
- Apr 05, 2024
as733y you can do it with far fewer lines of JSON and a much simpler syntax to understand:
{ "$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 <= addDays(@now, 45), 'darkGoldenRod', if(@currentField > addDays(@now, 45) && @currentField < addDays(@now, 90), 'teal', '#565757')))", "color": "white" } }Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
Rob_Elliott
Apr 05, 2024Silver Contributor
as733y you can do it with far fewer lines of JSON and a much simpler syntax to understand:
{
"$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 <= addDays(@now, 45), 'darkGoldenRod', if(@currentField > addDays(@now, 45) && @currentField < addDays(@now, 90), 'teal', '#565757')))",
"color": "white"
}
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)