Forum Discussion
jomy12
Dec 15, 2023Copper Contributor
Lookup in Lists Board view
I have added a lookup column to a list. It displays correctly in the list view:
However, when switching to the Board View, it displays as [Object object]. How can I display this correctly as text?
3 Replies
Sort By
- BarryGoblonIron Contributor
To resolve the issue of a lookup column displaying as "[Object object]" in the Board View, you can utilize a custom formatter. The default Board View doesn't show actual lookup values but rather as hyperlinks. The "[Object object]" message indicates this hyperlink display. To rectify this and display the actual lookup values, create a custom formatter using the following JavaScript code:
function formatLookupValue(value) {
// If the value is not null or undefined, it is the actual value of the lookup column.
// Otherwise, it is a hyperlink to the corresponding item in the parent list.
if (value) {
return value;
} else {
return "[Object object]";
}
}Add this custom formatter to the list view. To do it - open the list view in Edit mode. Click on the Edit Columns button. Select the lookup column you want to format. In the Formatter field, enter the name of your custom formatter function (e.g., formatLookupValue). Click on the Save button. Now, the lookup column should display correctly in the Board View, showing the actual values instead of "[Object object]."
I just tried it on our SharePoint site and lookup columns on the board views works fine:
Did you apply any advanced JSON formatting for your board view? If yes, you will have to adjust the JSON formatting to show the lookup column value correctly on your board view.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- jomy12Copper Contributor
ganeshsanap I tried resetting the card's formatting, but it's still showing [Object object]. Could you share the JSON version of your formatting so I could maybe recreate it?