umesh shukla
umesh shukla

Reputation: 171

Suite Script 2.0 - List all the Saved Search

Is there any way to get list of all the Transaction's Saved Search that I have created on NetSuite using Suite Script 2.0. Please see attached screen shot. enter image description here

Thanks in advance.

Upvotes: 1

Views: 2959

Answers (1)

Krypton
Krypton

Reputation: 5231

Yes, you can create a search of saved searches. You can run the following in your browser console to test, and modify to suit what you need:

require(['N/search'], function (search) {
  var savedSearches = search.create({
      type: search.Type.SAVED_SEARCH,
      filters: [
        ['recordtype','is','Transaction']
      ],
      columns: [
            search.createColumn({
                name: 'id'
            }),
            search.createColumn({
                name: 'title'
            }),
            search.createColumn({
               name: 'recordtype'
            })
       ]
    });
    savedSearches.run().each(
        function(r) {
           var a = r.getValue({
               name:'id'
               });
           var b = r.getValue({
               name:'title'
               });
           var c = r.getValue({
               name:'recordtype'
           });
           console.log(a + ' | ' + b + ' | ' + c);
           return true;
        }
    );

});

Upvotes: 2

Related Questions