SharePoint / SharePoint/sp-dev-docs

List Form Formatting treats lookup columns as flat value

Open
#6,974 7 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Jul 4, 2025.

area:list-formatting-form sharepoint-developer-support status:to-be-reviewed type:bug-confirmed type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Declarative list formatting

Developer environment

No response

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 FireFox
  • 💥 Microsoft Edge
  • 💥 Safari
  • 💥 Google Chrome
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details

No response

Describe the bug / error

When referencing a lookup column in List Formatting you have access to the value and the lookup list item id. In standard formatting you reference these using the following syntax:

[$MyLookup.lookupValue] - provides you the value (i.e. Dog)
[$MyLookup.lookupId] - provides you the list item ID from the target list (i.e. 4)

Using those same expressions from above when using form formatting will cause your header or footer not to render when your lookup has a value. Instead, you have to reference the field like so:

[$MyLookup] - provides you a flat value (i.e. 4;#Dog)

This is both inconsistent (so a bug) and terrible as it requires people to parse the values themselves using further expressions.

Until this is fixed, here is how you can reference the parts:

=Number(substring([$MyLookup],0,indexOf([$MyLookup],';#'))) - Returns the ID as a number
=substring([$MyLookup],indexOf([$MyLookup],';#')+2,1000) - Returns the value as text

This issue is present in both the formatting for form header/footer and in expressions used for conditional field display.

Steps to reproduce
  1. Create a list with a lookup
  2. Reference that lookup on your form with this basic format in the header:
{
  "elmType": "div",
  "txtContent": "[$MyLookup]"
}
  1. See the value in the flat format described above
  2. Wipe away your tears and use the work around expressions from above
Expected behavior

Lookup values should be accessible just as they are in all other forms of List Formatting by using the .lookupValue and .lookupId sub props.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.