Create a search using SuiteScript 2.0 by providing the result range

Hi guys, Today I am just explaining a very simple way to add a search in your code. Basically we face some difficulties while creating a search in our scripts. So just follow my code and create your own search without spending anything...

// This is the easy way to add filter.
var filters=[

//This is a very easy way to add column (If you didn't use the summary then just remove that line from code.)
var columns = [];
    columns[0] = search.createColumn({
    name: 'entity',
    summary: search.Summary.GROUP
    var search1 = search.create({
       type: "customerpayment",
       filters: filters,
       columns: columns
    var resultSet =;
    var resultRange = resultSet.getRange({
    start: 0,
    end: 100
    for (var i=0; i<resultRange.length; i++)    
        var result = resultRange[i];
        var customerId = result.getValue({name: "entity",summary: "GROUP"});
        // if you removed summary from column then please remove it from here too.

This is a 100% working code. We can use this search anywhere is the code in NetSuite Suite Script 2.0 version.
Note: If you need any type of code just let me know and I will serve you in the best way and earliest available time.

Please let me know your comments regarding above code.

Like it? Share with your friends!



Your email address will not be published. Required fields are marked *

  1. Hi, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam remarks? If so how do you reduce it, any plugin or anything you can suggest? I get so much lately it’s driving me insane so any assistance is very much appreciated.