Hello, anyone encountered this issue/error I'm try...
# suitescript
v
Hello, anyone encountered this issue/error I'm trying to setvalue to a multi select field and I'm encountering an invalid field value
Copy code
You have entered an Invalid Field Value 14831\u000514603\u000518305\u000522163\u000524013\u000520193\u000514732\u000525042\u000523121\u000514596\u000514887\u00054\u000514597\u000515486\u000523942\u000525041\u000520903\u000515042\u00051582\u000514598\u000514884\u000514722\u000523187\u000518306\u000521040\u000524982\u000518303\u000514733\u000515592\u000514604\u000518745\u000515513\u000521459\u00051579 for the following field
but when I logged the array that I am passing to set the field, not sure where the \u0005 comes from.
e
Post the code that's trying to set the field
v
Copy code
for (const key of Object.keys(params.values)) {
        const fieldId = key;
        const value = params.values[key];
        config_rec.setValue({ fieldId, value });
}
params.values
j
split the value you are trying to set on ‘\u0005’ to turn it into an array before passing it to setValue
j
^ I can't remember the exact contexts in which this happens but in some contexts when getting the value from a multiselect field it will come back delimited by \u0005 instead of by comma. a function
parseMultiselect
that splits on the regex
/,|\u0005/
can be useful to handle either case