I am trying to set the value of a multi-select field with the array:
["303","430","203","304","444","426","305","325","308","427","460","433","310","428","429","446","432","313","314","323","424","425","321","467","431"].
When saving the record in my map reduce script, I get the following error:
{"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 303\u0005430\u0005203\u0005304\u0005444\u0005426\u0005305\u0005325\u0005308\u0005427\u0005460\u0005433\u0005310\u0005428\u0005429\u0005446\u0005432\u0005313\u0005314\u0005323\u0005424\u0005425\u0005321\u0005467\u0005431 for the following field: custentity_avail_group","stack":["Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:74:24)\n at Object.map (/SuiteScripts/Map Reduce/Customer/assign_availability_groups_mr.js:151:37)"],"cause":{"type":"internal error","code":"INVALID_FLD_VALUE","details":"You have entered an Invalid Field Value 303\u0005430\u0005203\u0005304\u0005444\u0005426\u0005305\u0005325\u0005308\u0005427\u0005460\u0005433\u0005310\u0005428\u0005429\u0005446\u0005432\u0005313\u0005314\u0005323\u0005424\u0005425\u0005321\u0005467\u0005431 for the following field: custentity_avail_group","userEvent":null,"stackTrace":["Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:74:24)\n at Object.map (/SuiteScripts/Map Reduce/Customer/assign_availability_groups_mr.js:151:37)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":true}
It looks like all "," are replaced by \u0005. Not sure why this is happening. I tried removing it with this code but got the same error:
for(let i = 0; i < availabilityGroups.length; i++){
newAvailabilityGroups[i] = availabilityGroups[i].replace(/[\x00-\x08\x0E-\x1F\x7F-\uFFFF]/g, '');
}