Enabling Optimistic Locking for Custom Records

Each custom record type has a Enable Optimistic Locking option that can be enabled to protect custom record data integrity.

Sample Custom Record Type record with Enable Optimistic Locking box highlighted.

Enabling this option causes the system to check for conflicting updates whenever a user or script attempts to save updates to an instance of this custom record type. If another user or script has saved updates to the same custom record instance during the time that the first user or script was entering updates, the following message is returned:

“Unable to save record. Record was changed by a different user. Please reload and try again.”

The Enable Optimistic Locking option is enabled by default for all custom record types created as of 2012.2 and later. For backward compatibility, this option is disabled by default for custom record types created prior to 2012.2. You should enable this option, but first review any scripts that may be affected by this change and edit them as needed.

This support for optimistic locking makes custom records' concurrency control consistent with the optimistic locking used generally for NetSuite standard records. Optimistic locking assumes that multiple concurrent transactions can usually complete without affecting each other, so data resources do not have to be locked during the time that transactions are in process. Instead, a check for conflicts occurs before each transaction is committed. For more information about optimistic locking, you can review a related article at http://en.wikipedia.org/wiki/Optimistic_concurrency_control.

Related Topics

General Notices