Forum Discussion

dbolumar's avatar
dbolumar
Copper Contributor
Aug 06, 2024

MSList - SharePoint - Issue with lookup fields in Board view [object Object]

Dear community,

 

I am facing an issue when trying to show the value of a lookup column in MS-Lists Board view. I have seen many related topics in the forum but haven't found the solution.

 

Basically, when trying to show the field in the Board View, instead of showing the value from the Lookup function, the field always shows the same string [object Object]

 

I have tried to play with the JSON code in the formatter, so far unsuccessfully. This is the related piece of JSON code.

 

{

"elmType": "div",

"style": {

"display": "=if ([$KitProvider] == '', 'none', '')"

},

"children": [

{

"elmType": "p",

"attributes": {

"class": "ms-fontColor-neutralSecondary sp-card-label sp-card-boldText"

},

"txtContent": "[!KitProvider.DisplayName]"

},

{

"elmType": "p",

"attributes": {

"title": "[$KitProvider]",

"class": "ms-fontColor-neutralPrimary sp-card-content "

},

"txtContent": "=if ([$KitProvider] == '', 'โ€“', [$KitProvider])"

}

],

"attributes": {

"class": "sp-card-displayColumnContainer"

}

},

 

I am highlighting in bold the part I think I should tweak to solve the issue.

 

I have found also a thread (https://techcommunity.microsoft.com/t5/sharepoint/ms-list-board-view-text-not-showing/m-p/3263445) that links the issue to the "card designer" being enabled. While it is true that the issue disappear if the card designer is disabled, it also quite a bit limits the options to display the information in the card.

 

Is someone aware of a solution for this topic without disabling the card designer? Maybe a JSON hero that could help me here?

 

Thanks a lot in advance!

David.

2 Replies

  • dbolumar's avatar
    dbolumar
    Copper Contributor
    Dear all,

    After some googling, chatGPT research and testing, the following code, replacing the previous line in bold, can resolve the issue:

    "txtContent": "=if ([$KitProvider] == '', 'โ€“', [$KitProvider.lookupValue])

    However, over the course of the MS-List development I had used this many times and had not worked previously (including refreshing the page several times)... So, I can't answer why it is finally working (but it is ๐Ÿ™‚)

    Hope this is helpful to others,

    Kind regards,
    David.

    • Jax_M's avatar
      Jax_M
      Copper Contributor

      Thank you, you saved me lots of hassle posting this ๐Ÿ˜

Resources