Forum Discussion
Conditional formatting based on Null value of field
- Mar 27, 2024
Are you trying to change the color in list view using column formatting or on list form using form formatting?
First schema code given is for column formatting and seconds schema code is for form "body" formatting.
Unfortunately, form "body" formatting does not support conditional schema like column/view/form header/form footer formatting:
Unlike the header and the footer, body configuration only allows defining one or more sections and adding one or more columns into each of those sections.
Source: Configure custom body with one or more sections
Related read: Make section border/separator invisible in list form body custom layout with JSON
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Are you trying to change the color in list view using column formatting or on list form using form formatting?
First schema code given is for column formatting and seconds schema code is for form "body" formatting.
Unfortunately, form "body" formatting does not support conditional schema like column/view/form header/form footer formatting:
Unlike the header and the footer, body configuration only allows defining one or more sections and adding one or more columns into each of those sections.
Source: Configure custom body with one or more sections
Related read: Make section border/separator invisible in list form body custom layout with JSON
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Use advanced formatting under the column view and add this JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"@currentField",
"Title"
]
},
"",
"#FFF399"
]
}
}
}