<img src="https://ws.zoominfo.com/pixel/5BFMW73xT6Cu70sN1cUt" width="1" height="1" style="display: none;">

Troubleshooting: How to Handle "The Record Is Locked by a Workflow Action" Even When Your Script Runs as Admin

Posted by Steven Chao on Oct 21, 2025 9:00:01 AM
Steven Chao

ns1

What happen?

Recently, I ran into a puzzling issue while building a customization in NetSuite. I had a User Event (UE) script that added a custom button to a record. When clicked, the button would open a Suitelet, which then generated a template for printing.

Both the UE and the Suitelet were explicitly set to execute as Administrator. On paper, this should have bypassed most permission or locking concerns. But when users clicked the button, they were greeted with the dreaded error:

"The record has been locked by a user defined workflow."

At first, this feels like a script-level problem. But here's the key insight:
Once a record is locked by a workflow, no script context—including admin execution—can bypass it.

So, what can you do?

What can you do

Step 1: Identify Which Workflow Is Locking the Record

The error doesn't tell you directly which workflow is causing the issue. The quickest way is to:

  • Go to the record type page in Scripted Records.
  • Review the workflows associated with that record.
  • Pinpoint the workflow that might contain locking actions.

Step 2: Check the Workflow Actions

Within the workflow, look for "Lock Record" actions.

  • Open each workflow state and review the actions.
  • Pay special attention to the Execution Context (the contexts in which the lock applies).

Step 3: Adjust the Context Restrictions

Here's the trick: the record lock isn't global—it depends on the contexts you've defined in the workflow.

For example, in my case, the Suitelet was calling record.load() to fetch data for template printing. The lock was applied to Suitelet context, which blocked my script even though it was running as admin.

The fix:

  • Edit the workflow action.
  • Remove Suitelet from the restricted contexts.

Key Takeaways

  • Record locks from workflows override script execution contexts. Even an "execute as admin" script cannot bypass them.
  • The only way to resolve this is by adjusting the workflow itself, not the script.
  • Review the workflow's lock actions and contexts to allow your Suitelet (or other script type) to safely read/update the record.

Summary

  • Lock by workflow cannot be bypassed by SuiteScript.
  • You must adjust the workflow to exclude the script type (e.g., Suitelet) from the lock context.

About Us

Concentrus is a leading provider of innovative cloud-based enterprise resource planning (ERP) solutions, including NetSuite. Our team of NetSuite experts offers a range of services, including NetSuite price analysis, NetSuite training, and NetSuite integration services.  

Our goal is to help businesses of all sizes maximize their investment in NetSuite by providing expert NetSuite cost optimization and implementation strategies. With years of experience as a NetSuite partner, our NetSuite administrators and NetSuite consultants are well equipped to help businesses of all sizes with their NetSuite consulting needs.  

Whether you're looking for a NetSuite consultant to help with your NetSuite implementation or you need ongoing NetSuite support, Concentrus is here to help. 

 

Read About Our Implementation Methodology

 

Want more NetSuite Tips and Tricks? Check out our Short & 'Suite videos

 

Tags: NetSuite, ERP, NetSuite Partner, NetSuite How To's, NetSuite Tips, Workflow, TroubleShooting, SuiteScript 2.1, User Event Script, suitelet, Record Lock

Subscribe to our blog!

Recent Posts

Posts by Topic

see all

Request a quote