Show the object value for a multi choice field into lookup field appearance

Hello,

In a sharepoint list I have these fields.

In the same site I have another list where when I insert a new item, in the form, I need to show for the Market lookup field the values of:

  • code (single line text)
  • companyCode (multi choice)
  • Decription (single line text)

I’m trying to use this js code:

fd.spBeforeRender(function() {
    
    var templateMarket = '';
    templateMarket += '<span class="lookup-col">';
    templateMarket += '<p class="lookup-title"> #: data.LookupValue # - #: data.Description ? data.Description : "" #</br></p>';
    templateMarket += '<p class="lookup-desc"> Company: #: data.companyCode ? data.companyCode : "" #</p>';
    templateMarket += '</span>';

// Market   
    fd.field('market').widgetOptions = {
        template: templateMarket,
        height: 400,
        virtual: {
            itemHeight: 55
        },
        dataSource: {
            pageSize: 16
        }
    }
});

But I get this:

How I can get tha value of the object?

Thank you.

Hi @stefano.mazzi,

A Choice field might have several options selected, so its value is stored as an array. You can use this code to display all selected options:

data.companyCode.join(" ")

Or this code to only display the first selected option:

data.companyCode[0]

Let me know if this helps.