1

New to this still on the learning road.

Situation. I have a SharePoint list that contains the following columns: Name, DOB, Location, Comments.

I need to use a conditional formatting rule that in the situation that the comments cell contains the text ".iso" the Name cell and the Location cell needs to change background into yellow. Is there a way to use a JSON script because with simple conditional formatting rules I cant create the condition if the column contains specific text.

Thanks in advance.

1 Answer 1

0

Add the following JSON to [Name] and [Location] columns

 
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(indexOf(toLowerCase([$Comments]), '.iso')>-1, '#FFFF00', '')"
  }
}

enter image description here

See Column Formatting and Reference

5
  • Thank you for the quick reply. Unfortunately I cant make it work. I have changed the column name with the field number and also tried lower and capital letters but getting no reaction. The only time the Location column changes colour in yellow is when changing the ">-1" to "!=1" but with nil selection re the .iso being present. Commented Jun 21, 2024 at 7:52
  • @Ciprian, you have to use internal name your comments column in JSON. Check: How to find the Internal name of columns in SharePoint Online?. Commented Jun 21, 2024 at 8:14
  • Hi. I was using the internal name with a small difference. I was using Field_3 instead of field_3. First letter seems to bee the issue. All working fine now. Thank you Commented Jun 25, 2024 at 4:29
  • Hi Ciprian, perhaps you could say thank you by accepting the answer Matiur has given. (We love collecting points for answering questions) Commented Jun 26, 2024 at 13:47
  • Sorry didn’t know how this is working 🤔 Commented Jun 28, 2024 at 2:22

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.