Forum Discussion
smithme
Feb 25, 2021Brass Contributor
Simple row color by lookup field
All I am trying to do is color code the rows by the value of a Status lookup field. The documentation says this will work:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass":"=if([$Status]=='Not Assigned','sp-field-severity--severeWarning', '')"
}
However, SharePoint complains that "additionalRowClass" is expecting an object. The schema for "additionalRowClass" can be found here. But it is difficult the determine what the attribute wants just looking at the schema.
I can't find an example of what "additionalRowClass" wants to just change the row background color.
Seems you are using wrong JSON schema. You should use
https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json.
And not this:
https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json
For view formatting, refer below Microsoft official documentation:
View formatting - Apply conditional classes on rows
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.
- RobElliottSilver Contributor
ganeshsanap ..which of course was what I demonstrated in my post 🙂
Rob
Los Gallardos
Microsoft Power Automate Community Super UserYes RobElliott.
I just wanted to add some explanation & mainly the link to Microsoft official documentation for view formatting. So, that OP can validate the current JSON as well as refer to the documentation for any changes/enhancements in future.
Hope you understand!
- RobElliottSilver Contributor
smithme it's the schema that's causing the problem. This will work:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if([$Status] == 'Not Assigned', 'sp-field-severity--severeWarning', '')" }
Rob
Los Gallardos
Microsoft Power Automate Community Super User