0

Column formatting is used in SharePoint Online to customize how fields in lists are displayed. Microsoft provide documentation regarding the use of JSON for column formatting.

As is described in the documentation, this works well for basic things such as adding a class depending on the name of the current field. For example:

  "attributes": {
    "class": "=if(@currentField == 'Done', 'sp-field-severity--good', if(@currentField == 'In progress', 'sp-field-severity--low', if(@currentField == 'In review', 'sp-field-severity--warning', if(@currentField == 'Has issues', 'sp-field-severity--severeWarning', 'sp-field-severity--blocked')))) + ' ms-fontColor-neutralSecondary'"
  },

The end result being:

Column formatting on the status of a column

However, is there a way to check values in the current column and apply a class or color to duplicate entries in that column?

For example, if there is a Person column entitled Participants. One list entry has the value, Smith, John. If another entry gets created and Smith, John is added again, both of these values would be highlighted or have a class applied.

2
  • Do you want to check every field for duplication or only few fields? Sep 12, 2019 at 10:44
  • @harshalgite, every field in one column. For example, if the column is 'Participants'. It would highlight if the same participant was listed twice. I edited my post and added that example. Thanks.
    – Ashton
    Sep 12, 2019 at 10:50

1 Answer 1

2

No.

In column formatting, you cannot access/use the column values from another list item/row.

You can only access the column values from the same list item/row like [$AnotherColumnFromSameRow].

Where AnotherColumnFromSameRow is internal name another column from same list item/row.

You can get the internal name of your list columns by following this article: How to find the Internal name of columns in SharePoint Online?

2
  • In this case, it is the same list but checking against values inside one column. So it is checking duplicate values inside the same column. Would this still apply?
    – Ashton
    Sep 12, 2019 at 10:55
  • 1
    No, it is not possible in column formatting. column formatting can access the column values from same entry only. it cannot access column values from different entries(same list - different entry/item). Sep 12, 2019 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.