Is there a different way to load ID aftersubmit

Hello NetSuite Professionals  – Receiving error “Invalid API usage. You must use getValue to return the value set with setValue”


For UserEvent Script, error recieved when creating a customer, but don’t receive an error when editing an existing customer .. is context.newRecord; correct or is there another way to load the customer ID for a customer just created, to reference?



* @NScriptType UserEventScript

* @NAPIVersion 2.0

function(record) {
return {

afterSubmit : function(context) {

var customer = context.newRecord;

var subsidiary = customer.getValue(‘subsidiary’);
if(subsidiary == 9){

var newsub = record.create({


isDynamic : true



fieldId : ‘entity’,

value :



fieldId : ‘subsidiary’,

value : 5

Rookie Asked on April 18, 2021 in SuiteScript.
Add Comment
1 Answer(s)

Nvm  .. turned out to just be a weird issue with demo account I was using, this works in other production/sandbox accounts.

Rookie Answered on April 19, 2021.
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   Become a Sponsor   Become a Sponsor