Search code examples
mapreducenetsuitesuitescript

Suitescript 2.0 MapReduce Script


I am very new to SuiteScript so I might be posting a lot of questions out here and hope you can all help.

My first question is why is my saved search not passing values on my MapReduce script? My code is below.

function getInputData() {
        try{
            log.debug("Get Input", "Initiated");
            //Customer Search
            var customerSearch = search.load({
                id: 'customsearch_brad_itemprice'
            });

            log.debug("customerSearch", customerSearch);
            log.debug("GetInputData", "Completed");

            return [customerSearch];
        }catch(exception){
            log.debug("GetInputDate Error Message:",exception);
        }
    }

Here is an image of the debug log that shows the variables are null.

Suitescript 2.0 Debug Log:

enter image description here

Your insights are greatly appreciated!

Brad


Solution

  • You are returning an array of searches. You need to return a search object

    Change this:

    return [customerSearch];
    

    to this:

    return customerSearch;