Job Queue Entry Fails: Record Locked by Another User (Database Lock Timeout)
The operation could not complete because a record in the Sales Header table was locked by another user. Please retry the activity.What It Means
A background job (for example Shopify order import, background posting, or an EDI import) waited for a record that another session held locked. The wait timed out and the job stopped with status Error. The table name in the message tells you where the conflict is (Sales Header, a No. Series table, Item Ledger Entry, and so on). Newer versions can show different wording for the same situation, but the cause is the same.
Root Cause
When a transaction writes data, SQL Server holds a lock until the transaction ends. If two sessions need the same rows at the same time (for example a user posting a sales order while a recurring job imports orders and also posts), the second one waits. If the wait passes the lock timeout, Business Central cancels it and shows this message. Recurring jobs that run very often, and several jobs that touch the same tables at the same time, make this more likely. The telemetry for a lock timeout shows only the victim session; the lock snapshot (RT0013) shows who held the lock.
Step-by-Step Fix
- Search for 'Job Queue Entries', select the failed entry, and choose 'Log Entries' (or 'Show Error'). Note the table name and the time.
- If it happens now, open page 9511 'Database Locks' to see which AL object or method holds the lock.
- If you have Application Insights, query event RT0012 (Database lock timed out) and the matching RT0013 (Database lock snapshot) by snapshotId to find the session and extension that held the lock.
- Put jobs that touch the same tables (for example Shopify order sync and background sales posting) in the same Job Queue Category Code. Entries in one category run one at a time; the next waits in status Waiting.
- Make recurring jobs run less often. Microsoft advises the largest interval you can accept (for example 15 minutes instead of 5). Move heavy batch jobs away from busy user hours.
- On the Job Queue Entry card, set 'Maximum No. of Attempts' and 'Rerun Delay (sec.)' so a short lock conflict is retried instead of leaving the entry in Error.
- Restart the failed entry: set it On Hold, then Ready (or use Restart).
Verification Steps
Sources & References
- https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-database-locks-trace
- https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/monitor-database-locks
- https://learn.microsoft.com/en-us/dynamics365/business-central/admin-job-queues-schedule-tasks
Early Access · 30-Day Sandbox Pilot
Stop Order Sync Failures Before Customers Notice
The Order Flow Doctor monitors Microsoft Dynamics 365 Business Central order flows across Shopify, EDI (TrueCommerce, SPS), 3PLs, and carriers. Get automated root-cause diagnosis and one-click fixes.