-
Notifications
You must be signed in to change notification settings - Fork 1k
List Form Formatting treats lookup columns as flat value #6974
Copy link
Copy link
Open
Labels
area:list-formatting-formCategory: List form formatting with JSONCategory: List form formatting with JSONsharepoint-developer-supportsharepoint-developer-supportsharepoint-developer-supportstatus:to-be-reviewedIssue needs to be reviewed by Microsoft for additional follow up / review.Issue needs to be reviewed by Microsoft for additional follow up / review.type:bug-confirmedConfirmed bug, not working as designed / expected.Confirmed bug, not working as designed / expected.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Metadata
Metadata
Assignees
Labels
area:list-formatting-formCategory: List form formatting with JSONCategory: List form formatting with JSONsharepoint-developer-supportsharepoint-developer-supportsharepoint-developer-supportstatus:to-be-reviewedIssue needs to be reviewed by Microsoft for additional follow up / review.Issue needs to be reviewed by Microsoft for additional follow up / review.type:bug-confirmedConfirmed bug, not working as designed / expected.Confirmed bug, not working as designed / expected.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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
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 textThis issue is present in both the formatting for form header/footer and in expressions used for conditional field display.
Steps to reproduce
{ "elmType": "div", "txtContent": "[$MyLookup]" }Expected behavior
Lookup values should be accessible just as they are in all other forms of List Formatting by using the
.lookupValueand.lookupIdsub props.