Hi all, is it possible to access the data in the s...
# suitescript
h
Hi all, is it possible to access the data in the summarize stage in a map/reduce script and not only for logging the data? I see the result in the execution log but the values array only returns true? I want to use the data from the key/value to update a status in Netsuite.
Copy code
function summarize(summary) {
            try {
                var values = []
                log.debug('summarize stage: ', summary)
                if (summary.inputSummary.error) {
                    log.debug('An error occurred.', summary.inputSummary.error);
                }

                summary.output.iterator().each(function (key, value) {
                    log.debug('Output for key ' + key, value);
                        
                    values.push(value);    
                    return true;
                });
                JSON.stringify(values);
                log.debug('value ' + values);
                
            } catch (e) {
                log.debug('error', e.message)

            }
        }
message has been deleted
log.debug('summary values', values);
b
id double check what you are writing in your reduce function
the first parameter to log.debug will show up in the title column, the second parameter will show up in details
your logs are consistent with value being undefined
h
I removed my reduce function. I create this object in map and send it to summary stage: var summaryObj = { recId:recId, customers: customerId } context.write(summaryObj)
b
thats not the parameter signature of mapContext.write, dont expect netsuite to convert that in the way you expect
👍 1