Execution Order of Deployed Scripts

NetSuite sets script execution order in two steps: it first groups deployments by entry point, then executes them in the order shown on the Scripted Records page.

Note:

Besides the two-stage sequence, keep these behaviors in mind:

  • NetSuite sets execution priority at the script level—not for individual entry points.

  • In user event scripts, the afterSubmit phase starts with scripts that also have a beforeSubmit entry point, then follows the listed order.

The following example involves four deployed user event scripts on any record. The table shows their order on the User Event Scripts subtab, and the entry points each script defines.

List Position in the Subtab

Script

Defined Entry Points

1

Script A

beforeLoad

afterSubmit

2

Script B

beforeLoad

beforeSubmit

3

Script C

afterSubmit

4

Script D

beforeSubmit

afterSubmit

NetSuite executes the entry point functions in this order:

Although Script D is listed last on the subtab, its afterSubmit function runs before those in Scripts A and C because it also has a beforeSubmit entry point.

Note:

The following scenarios can also affect execution order:

  • If the record also has a workflow with an afterSubmit event, NetSuite finishes the user event script first.

  • When both localized and non-localized scripts exist on a record, non-localized scripts run first. For more details on localized client scripts, see Localization Context.

Related Topics

General Notices