Expand your SuiteScript skills in the Sustainable SuiteScript community for NetSuite developers.

Transaction Searches Returning Duplicate Results

Created: July 5, 2017

While we're on the topic of Search Filters, Shane had this question today in my Coaching program :

Would you be able to help me here. I am looking at Item Fulfillments and displaying each item associated with it which in this case is 1 item. The problem I'm having is, when I create my search and loop through it, it is finding 3 that seem identical.

var mySearch = search.create({
    type: 'ITEMFULFILLMENT',
    columns: ['tranid', 'item', 'quantity', 'item.displayname','location', 'item.itemid', 'status', 'entity', 'statusRef'],
    filters: ['tranid', 'is', 'IF15']
}).run().each(function (items) {
    form.addField({...})
    return true
})

Any idea?

Great question, Shane! Yes I do have an idea!

You're seeing the seemingly identical results because of how Transaction Searches behave in NetSuite; in order to narrow down your results correctly, you'll want to research and understand the mainline filter: