0

I have a list with a lookup field that references another list called Area. The other list has a field called CssClass that I've projected into the main list in order to use it for custom JSON formatting:

Screenshot of list

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "box-sizing": "border-box",
    "padding": "0 2px",
    "overflow": "hidden",
    "text-overflow": "ellipsis"
  },
  "attributes": {
    "class": "[$Area_x003a_CssClass]"
  },
  "txtContent": "[$Area.lookupValue]"
}

My problem is that I don't want to display the Area:CssClass field in my views of the main list, but the value from this projected field doesn't seem to be available to the formatting code unless it's visible in the same view.

Screenshot with no formatting

Is there a way to use this projected field value without including it in the view?

2 Answers 2

0

Oops, found the answer here, apparently fields referenced in JSON formatting must be included in the view.

0

There is also one work around which I have mentioned in below questions:

List formatting, column not loaded

If you can add that column in Order By then it should work as well.

1
  • Thanks for the suggestion but this didn't work in my case. Possibly because the column I want is a Lookup column? Commented Sep 15, 2022 at 14:35

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.