Feb 07 2021 02:41 PM
I have applied a custom JSON formatting to several SharePoint online columns (new experience).
I’m using JSON formatting in a couple of people picker columns with multiple selections enabled, so that the formatting will alert the user in Quick Edit mode if they selected more than one name (I had to leave Allow Multiple Selections as “Yes” for these fields for other requirements).
If the name count is grater than 1, the field/column gets a flashy red formatting and an error text.
It all works great for all fields, and the below JSON column formatting is applied to the columns in views and on display form in the Details Pane. It also works well in the full page Display Form (DispForm.aspx ?ID=XX) except for one multi people picker that does not change the formatting when the user changes the value:
In the screen recording below you can see the same scenario applied to two different columns on the same list, both columns have the exact same JSON formatting:
Any idea why one field would reflect a change in value in quick edit mode, and another field (of the exact same type, configuration and formatting) would not?
Here's the JSON formatting I use for both fields:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "0 2px",
"border": "=if(length(@currentField)>1,'5px dashed red','none')"
},
"children": [
{
"elmType": "span",
"style": {
"color": "red",
"font-size": "20px"
},
"attributes": {
"iconName": "=if(length(@currentField)>1,'Error','')"
}
},
{
"elmType": "span",
"style": {
"color": "=if(length(@currentField)>1,'Red','')"
},
"txtContent": "=if(length(@currentField)>1,'Please Select Just One Approver!\n\n'+@currentField.title,@currentField.title)"
}
]
}