```var item_category = search.lookupFields({ t...
# suitescript
m
Copy code
var item_category = search.lookupFields({
    type: search.Type.ITEM,
    id: item_name,
    columns: 'custitem_item_category'
});

log.debug({title: "Item Category", details: item_category.custitem_item_category});

How do I get the ID value from a select field? I've always managed using a free text before. Right now it returns an empty array []
s
log
item_category
instead, it should not be an empty array, if it is an empty array then the value is not set.
m
actually, this does give me a value:
Copy code
log.debug({title: "Item Category", details:item_category.custitem_item_category[0].value});
but if the field does not have any values it throws error, so is there a way to handle this?
I was able to handle the scenario where no values in the array exists