Hi Antti, my answer is 100% AST. I use it in my SharePoint 2019 environment. You must have made a typo somewhere.
SharePoint 2019 JSON formatting
Could someone tell me, how can I show column with green background if date value is 45 days greater than current date? If data is in this 45 range, show it yellow.
my current JSON: (shows all future date items with green)
{
"operator": ">=",
"operands": [
"@currentField",
"@now",
{
"operator": "+",
"operands": [
"@now",
"3888000000"
]
}
]
},
"sp-field-severity--good",
Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint For business Windows
1 additional answer
Sort by: Most helpful
-
Yanli Jiang - MSFT 31,596 Reputation points Microsoft External Staff
2023-11-29T10:03:56.5766667+00:00 Hi @Antti Astikainen ,
You can do this using the IF function:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "background-color": "=if(@currentField >= @now+3888000000, 'green',if(@currentField < @now,'white','yellow'))" } }
The result:
Hope this is helpful.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.