How to access the search LookupFields result

Viewed 5504

Below is my search code. I'm searching for the Invoice number by using the invoice internal ID.

What is the right way to access the lookupFields search result?

var invoiceNumber = fieldLookUp.value;

I'm using the above line but the "invoiceNumber" is empty. Thanks for your help.

var fieldLookUp = search.lookupFields({
                    type: search.Type.INVOICE,
                    id: invoiceId,
                    columns: 'tranid'
                });

                var invoiceNumber = fieldLookUp.value;
2 Answers

If you want to get only the value

fieldLookUp[0].value

or vice versa, if you want to get the text data

fieldLookUp[0].text
Related