mapreducetasknetsuitesuitescript2.0

how to pass record id and script id from getinputdata to map stage in Netsuite map reduce script?


I am passing search results from getinputdata to map stage using return. Ho can i pass recordid and script id to map? Please help!

 function getInputData() {
        try {
            var scriptObj = runtime.getCurrentScript();
            var scriptId = runtime.getCurrentScript().id;
 var recordId = runtime.getCurrentScript().getParameter({
                name: 'custscript_record_id'
            });
            log.debug("scriptId",scriptId);
            if(recordId)
            {
            var searchID = 'customsearch_je';
            //log.debug("searchID", searchID);
             var searchObj = search.load(searchID);
            searchObj.filters.push(search.createFilter({
                name: 'internalidnumber',
                operator: search.Operator.EQUALTO,
                values: recordId
            }));
            }
            else
            {
            var errorSearchID = 'customsearch_je_error';
            log.debug("errorSearchID", errorSearchID);
            searchObj=search.load(errorSearchID);
            }
            return getMoreRecords(searchObj),scriptId;
            } catch (error) {
                log.error("Error in getInputData", error);
            
            }
    } 

Solution

  • You have 2 solutions for that:

    1. Use runtime, in the map stage like you do in getInputData
    2. Work on your returned array to includes this 2 informations.

    The first option is easier.