ReferenceError: "Map" is not defined.
I'm trying to create a Map object in a Map/Reduce script but apparently is undefined in SuiteScript Map/Reduce.
I'm defining the map the same way it's defined in JS, I've tried the same line of code in a Client Script (SS 1.0) and it worked, does this have anything to do with the fact that it's a Map/Reduce script so there'd be an alternative for a Map object?
try{
var myMap = new Map();
log.debug('myMap',myMap);
var val1 = searchresult[0].getValue('id1');
var val2 = searchresult[1].getValue('id2');
myMap.set(val1, val2);
log.debug('myMap - set',myMap);
}
catch(e){
log.error('error',e);
}
Map
is an ES6+ feature. Make sure your Map/Reduce is targeting SuiteScript 2.1.