See the Help for `record.create()`
# suitescript
e
See the Help for
record.create()
a
Thanks @erictgrubaugh, is there any way to set all the values once not using setValue for each field?
s
It's in the help pages if you look at record.create, I read that wrong. The typical behavior is make an object/array, then iterate on it to reduce repeating code
a
Thanks
e
Copy code
let myRec = r.create(...);
[
  {fieldId: "entity", value: 123},
  {fieldId: "custbody_blah", value: 4566},
  ...
].forEach(f => myRec.setValue(f));
myRec.save();