I have a script that stopped working a few week ag...
# suitescript
b
I have a script that stopped working a few week ago... I am getting an error... "message":"Invalid custbody_creator reference key -4.", THis is the script where the error occurs.... I am setting the custbody_creator to a real value... never -4
Copy code
log.debug('OrigCreator', OrigCreator);
                 objWhInvoice.setValue({
                     fieldId: 'custbody_creator',
                     value: OrigCreator
                 });
log.debug('COUNT', '6');   // FAILING AT THIS POINT
                var intWhInvoiceId = objWhInvoice.save({
                    ignoreMandatoryFields: true,
                    enableSourcing: true
                });
... so why does the error say "-4".... -4 certain is invalid and doesn't exist, but it doesn't appear to let me change it.
a
This is a bug triggered by one of the native Approval Workflows, when you create a record that triggers a native NetSuite process that creates another record, that second record is created by -4 (System) but the approval workflows or field trying to be populated with the Created By(User) are not able to set the value to -4.
If you have a workflow trying to set a custom field to the create by value (user) you need to put a condition to skip -4 because nor your workflow or script would be able to set the field value to -4.
b
Thanks I had just found that and was running some tests... it appears to be working now 🙂