Environment: SharePoint 2019 On Premise
Requirement: If a Number column value is equal to 0 then set sp-field-severity--good else set sp-field-severity--warning
Trial: Based on the article at Use column formatting to customize SharePoint have prepared and set the below JSON
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "=if(@currentField <= 0,'sp-field-severity--good', 'sp-field-severity--warning')"
}
}
However it doesn't work.
I tried to check the DOM it shows as bellow
Note: As per the instructions in MS article I am using https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json schema as it is SP 2019 On Prem.
What am I missing?