jdcaliff
jdcaliff

Reputation: 143

How to set up user to control Saved Search Criteria in NetSuite Suitelet SSv2

I am trying to set up a Suitelet to give the user the option of adjusting the criteria of a saved search. I have set up search with ID customsearch_ca_export_detail_search__38 and I would like to be able to control the criteria of this search within the Suitelet. I would prefer to use SSv2 but I am not finding instructions for this in the documentation. How do I do this?

Upvotes: 2

Views: 219

Answers (1)

michoel
michoel

Reputation: 3783

/**
*@NApiVersion 2.x
*/

require(['N/search'], function(search) {

    function loadSearchAndAddFilter() {

        var searchObj = search.load({
            id: 'customsearch_ca_export_detail_search__38'
        });

        var filters = searchObj.filters;

        var filter = search.createFilter({
            // create new filter here
        });

        filters.push(filter);
        searchObj.filters = filters;

        searchObj.run().each(function(result) {
            // access search results here
            return true;
        });
    }

    loadSearchAndAddFilter();
});

Upvotes: 2

Related Questions