Create a Search for a Custom Record Type

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

The following sample creates a search for a custom record type. To search for a custom record type, you must specify a type of search.Type.CUSTOM_RECORD and add the ID of the custom record type (as a string). In this sample, the ID of the custom record type is 6. The custom record also includes a custom field named custrecord1.

          /**
 * @NApiVersion 2.x
 */

require(['N/search'], function(search) {
    var myCustomRecordSearch = search.create({
        type: search.Type.CUSTOM_RECORD + '6',
        title: 'My Search Title',
        columns: ['custrecord1']
    }).run().each(function(result) {
        // Process each result
        return true;
    });
}); 

        

General Notices