Setting Default Values on Record Creation
For some reason, whenever I try to use record.create() and set default values in SuiteScript, I get this error message: “You have entered an invalid default value for this record initialize operation.”
I can’t figure out why the error. The only field I’m setting is the name field and the value is a string, which I’m able to set successfully in the UI. The field ID seems to be correct (altname). It’s a UE script. The only thing I can think of is maybe custom records aren’t supported.
Anyone else run into this?
I’ve run into issues trying to load fields using the defaultValues parameter for some fields. Instead, try loading values with the setValue statement. Sample below:
var newcustrec = record.create({
type: ‘customrecord_my_customrec’,
isDynamic: true});
newcustrec.setValue({
fieldId: ‘custrecord_sample_qty’,
value: 100});
newcustrec.save();



