netsuite User Event: Before Load event

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


SuiteScript 2.0-
scriptContext.newRecord{N/record.Record} A reference to the record being loaded from the database
scriptContext.type{UserEventType} The action type that triggered this User Event
scriptContext.form{N/ui/serverWidget.Form} A reference to the UI form that will be rendered
SuiteScript 1.0-
type{Object} The action type that triggered this User Event
form{nlobjForm} A reference to the UI form that will be rendered
request{nlobjRequest} the HTTP GET request; only available when triggered by browser requests



The Before Load event is triggered by any read operation on a record. Any time a user, a script, a CSV import, or a web service request attempts to read a record from the database, the Before Load event gets fired.

Record actions that trigger a beforeLoad event:

  • Create
  • Edit
  • View / Load
  • Copy
  • Print
  • Email
  • QuickView

Typical Use Cases for beforeLoad

  • Modify the UI form before the user sees it
  • Set default field values
  • Data pre-processing

User Events do not chain

Code written in User Events will not trigger any User Events on other records. For example, loading the associated Customer record from the beforeLoad of a Sales Order record will not trigger the Customer record's beforeLoad. Even if you are loading another Transaction record, its User Events will not be fired.

NetSuite does this to avoid User Events triggering each other in an infinite loop. If you do need User Events to fire in a chained sequence, other script types (e.g. RESTlets, Suitelets, Scheduled Scripts) will need to be injected in between the events.

Event Handler returns void

The return type of the beforeLoad event handler is void. Any data returned from our event handler has no effect on the system. We do not need to return anything from our handler function as we cannot actually do anything with its returned value.

Got any netsuite Question?