Tom Hanson
Tom Hanson

Reputation: 935

SuiteScript 2.0 Search Getting Columns Not Results

I am loading a saved search in our NetSuite account using SuiteScript on a Suitelet script.

var itemSearchSet = search.load({
    id : 'customsearch253',
});

I am then adding a new filter to the search

itemSearchSet.filters.push(search.createFilter({
    name : 'itemid',
    operator : search.Operator.ANYOF,
    values : [itemId]
}));

I then run the search and return the results

return itemSearchSet.run();

The results I am getting from this is the columns themselves not the results. I have search heaps of things online and found nothing that matches my issue. Please help :)

Upvotes: 0

Views: 1467

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8847

run() is not sufficient to retrieve actual results. From there, you'll either need to invoke each(callback) to iterate over the results directly or getRange() to grab an explicit chunk of the results.

I have a whole bunch of search examples in this YT playlist: https://www.youtube.com/watch?v=2XFuqQrOUIg&list=PLG2tK6Va2WUBP_JCf4nVAbFc6vGuB_lBm

Upvotes: 2

Related Questions