Parameter | Details |
---|---|
SuiteScript 2.0 | - |
scriptContext | {Object } |
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 |
beforeLoad
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:
beforeLoad
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.
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.