Reputation: 277
I'm using the NetSuite Contracts Renewals module and trying to make a NetSuite User Event script (SuiteScript 2.0) that sets a custom field value on the Contract Item record based on the original sales order.
The script works fine when I edit/save the record manually but when I use the "Create Contract Item" button on the Contract record I get the following error:
INVALID_FLD_VALUE You have entered an Invalid Field Value 8.0 for the following field: custrecord_count
The field is definitely an Integer field and it makes no sense that it would work in one context but not the other. I even tried hardcoding a value but no dice.
Anyone have any ideas?
Here's an example to illustrate how I'm attempting to set the value:
var contractItemRecord = context.newRecord;
contractItemRecord.setValue({
fieldId: 'custrecord_count',
value: 8
});
Upvotes: 3
Views: 5192
Reputation: 15377
SS2.0 is inconsistent in its type handling. Sometimes it works with the types as expected and sometimes it needs a string but does a poorer job of type coercion than SS1.0.
I'd try count.toString()
or count.toFixed(0)
Upvotes: 4