SuiteScript 2.x Standard and Dynamic Modes

When you create, copy, load, or transform records in SuiteScript, you can work with records in standard or dynamic mode.

Standard mode:

When a SuiteScript 2.x script creates, copies, loads, or transforms a record in standard mode, the record’s body fields and sublist line items are not sourced, calculated, and validated until the record is saved with Record.save(options). Standard mode is also called deferred dynamic mode and you see both terms in the SuiteScript help.

When you work with a record in standard mode, in most cases, you don't need to set values in any particular order. After a record is submitted, NetSuite processes the record’s body fields and sublist line items in the correct order, regardless of the organization of your script. See Getting Text in SuiteScript 2.x Record Modes.

Dynamic mode:

When a SuiteScript 2.x script creates, copies, loads, or transforms a record in dynamic mode, the record’s body fields and sublist line items are sourced, calculated, and validated in real time. A record in dynamic mode emulates the behavior of a record in the UI.

When you work with a record in dynamic mode, the order in which you set field values matters. For some developers, this aspect might feel constraining. It is likely that scripting in dynamic mode will require you to refer back to the UI often. For example, on an invoice in the UI, you would not set the Terms field before setting the Customer field. The reason is that as soon as you set the Customer field, the value of Terms will be overridden. On an invoice, the value of Terms is sourced from the terms specified on the Customer record. The same behavior happens in dynamic scripting. In your scripts, if you do not set field values in the order that they are sourced in the UI, some of the values you set could be overridden.

How you can tell if a record is in dynamic mode:

You can determine if a record is in dynamic mode using these two SuiteScript 2.x properties:

Record Modes and User Event Scripts

Standard mode is always used for user event scripts that instantiate records with the newRecord or oldRecord object provided by the script context. For that reason, the SSS_INVALID_API_USAGE error appears when a user event executes on one of these objects in the following situations:

Getting Text in SuiteScript 2.x Record Modes

In dynamic mode, you can use Record.getText(options) without limitation but, in standard mode, limitations exist. In standard mode, you can use this method only in the following cases:

Record Module Method Considerations

Be aware that the record.create(options), record.copy(options), record.load(options), and record.transform(options) methods work in standard mode by default. If you want these methods to work in dynamic mode, you must set the .isDynamic property for each method.

Related Topics

SuiteScript 2.x Scripting Records
SuiteScript 2.x Record Modules

General Notices