0

I am trying to set up conditional formatting for my SharePoint list, based on the value from different columns.

Here is what I was trying to set up:

  1. IF @ColumnName1 = "status 4" THEN @ColumnName2 be highlighted red if the cell is blank.
  2. IF @ColumnName3 = "" THEN @ColumnName4 be highlighted red if the cell is blank.

And more functions similar to them.

I have written some code, but I am not entirely sure how to create argument reference to another column. How this can be done?

Thank you in advance.

3
  • Check this: sharepoint.stackexchange.com/questions/233951/… Commented Mar 28, 2019 at 9:43
  • You can get the current column value using @currentField and other fields can be referenced as for example: [$DueDate]. Commented Mar 28, 2019 at 9:48
  • @Ganesh Sanap So here's my condition (what I want to set up): [link]IF Status = "status 4" THEN Current Field be highlighted red if the cell is blank And here's my code: 'code'{ "elmType": "div", "attributes": { "class": "=if(AND([$Status] == 'statust 4',@CurrentField == '') ,'sp-field-severity--blocked,'')" }, { "elmType": "span", "txtContent": "@currentField" } } Do you know what's wrong here? Commented Apr 1, 2019 at 10:32

1 Answer 1

1

Use SharePoint JSON column formatting for your columns like:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "attributes": {
    "class": "=if([$Status] == 'Status 4' && @currentField == ''), 'sp-field-severity--blocked, '')"
  },
  "txtContent": "@currentField"
}

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.