ANS-1656 · SUITESCRIPT DEVELOPMENT

How to Resolve “This Record Has Been Locked by a User Defined Workflow” Error in NetSuite

This guide explains how to modify NetSuite workflow configurations to prevent scripts from encountering record lock errors during execution.

Short answer

The "This record has been locked by a user defined workflow" error occurs when a script attempts to modify a record currently in a workflow state with a "lock record" action. To resolve this, identify the locking workflow and state, then edit the "lock record" action to exclude the script's context, or all script types, allowing scripts to interact with the record.

Scenario

Users may encounter an error message stating "This record has been locked by a user defined workflow" when a script attempts to perform an edit operation on a NetSuite record. This situation typically arises when the target record is in a workflow state that includes a "lock record" action, commonly found in approval workflows during "approved" or "pending approval" states.

Solution

To resolve the "This record has been locked by a user defined workflow" error, follow these steps:

  1. Review the active workflows and/or workflow logs associated with the record where the error occurs. This step helps identify the specific workflow responsible for locking the record and the exact state containing the "lock record" action.

  2. Once the workflow state has been identified, navigate to and edit the "lock record" action within that state.

  3. Modify the context of the "lock record" action to remove the specific script type that is encountering the error.

  4. Optionally, remove all script types from the context of the "lock record" action if scripts should generally be permitted to edit transactions that are in a locked state.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant