0

The following is part of JSON formatting in a SP List that turns rows red if field LookupFieldX is empty:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "additionalRowClass": "=if(length([$LookupFieldX.lookupValue])==0,'ms-bgColor-red','ms-bgColor-white'))))+ ' ms-fontColor-black'"
}

How do I extend the JSON so the empty field displays "TBD" in addition to the entire row being red? As you know, column formatting does not work for this because it is a lookup field.

1 Answer 1

1

Lookup field supports JSON column formatting, see Supported column types.

For your requirements, use this JSON:

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "=if(@currentField.lookupValue, @currentField.lookupValue, 'TBD')"
}

Before applying JSON:

enter image description here

After applying JSON:

enter image description here


Follow these steps to apply column formatting:

  1. Go to List view.
  2. To open the column formatting pane, open the drop-down menu under a lookup column name/header.
  3. Under Column Settings, choose Format this column.
  4. Make sure you have selected "Format columns" option & LookupFieldX under "Choose Column" dropdown like:

enter image description here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.