Exception on saving subsidiary via SuiteScript

What I try to do is to set a custom field on a subsidiary record in a Restlet post method, but I receive a strange exception about a field that I have not changed.

Here is the error I get – “Field mainaddress is not a subrecord field.”, it occurs on calling the record.save() method

And here is the code snippet:


let recordObj = record.load({

type: record.Type.SUBSIDIARY,

id: id,

});
recordObj.setValue({ fieldId: checkBoxFieldId, value: true });

recordObj.save({ ignoreMandatoryFields: true });

I’ve double-checked that the id and checkBoxFieldId params are correct. It seems that there is something that attempts to set the mainaddress incorrectly, but the only script in my NetSuite account that works with subsidiaries is my User Event, and it does not change the mainaddress field either.

I’d be glad to hear any ideas on what the issue can be, or how I can debug it

Rookie Asked on August 13, 2025 in SuiteScript.
Add Comment
1 Answer(s)

Fixed it, turns out the custom role that was executing this script didn’t have FULL permission to the Subsidiary list, instead it had only VIEW permission

Rookie Answered on August 14, 2025.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   SuiteMigration   Become a Sponsor