SOLVED

Sharepoint lists - Conditional formating, multiple lines column.

Steel Contributor

Hi,

 

Is it possible to format a columns in lists, based on a "multiple lines" eg if it it contains text, not empty.

lists cond formating.PNG

 

The columns name is "Kommentarer"

 

Best regards

- Geir

 

 

 

3 Replies
best response confirmed by Geir Hogstad (Steel Contributor)
Solution

@Geir Hogstad yes this is possible and you can see this in the More... multiple lines of text column in the image below. If there is text then the background color is blue, but the background stays white if there is no text:

multiLineJSON.png

 

Put the following JSON in the advanced mode screen when you format the column:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "padding-left": "14px",
    "background-color": "=if(@currentField != '','#4f7b95','#fffffc')",
    "color": "white"
  }
}


Rob
Los Gallardos
Microsoft Power Automate Community Super User

Great, thank you.

Best Regards
- Geir

@RobElliottWhat about if you have "Append changes to existing text" turned on? My use case has the append option selected. I'd like to highlight my column if changes have been made, and no background if there are no changes (something like below). This would be a visual cue for users to quickly see if changes (or really comments as I'm using it as a call log) have been made. Thanks...

 

CallLogexample.png

1 best response

Accepted Solutions
best response confirmed by Geir Hogstad (Steel Contributor)
Solution

@Geir Hogstad yes this is possible and you can see this in the More... multiple lines of text column in the image below. If there is text then the background color is blue, but the background stays white if there is no text:

multiLineJSON.png

 

Put the following JSON in the advanced mode screen when you format the column:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "padding-left": "14px",
    "background-color": "=if(@currentField != '','#4f7b95','#fffffc')",
    "color": "white"
  }
}


Rob
Los Gallardos
Microsoft Power Automate Community Super User

View solution in original post