Job Queue & Core BC BC Job Queue (background sessions) / SQL locks Microsoft Learn: Database Lock Timeout Trace Telemetry (RT0012, RT0013); Monitoring SQL Database Locks (page 9511); Schedule jobs to run automatically

Job Queue Entry Fails: Record Locked by Another User (Database Lock Timeout)

Raw System Error String
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

  1. Search for 'Job Queue Entries', select the failed entry, and choose 'Log Entries' (or 'Show Error'). Note the table name and the time.
  2. If it happens now, open page 9511 'Database Locks' to see which AL object or method holds the lock.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Restart the failed entry: set it On Hold, then Ready (or use Restart).

Verification Steps

How to verify: The job queue entry returns to Ready/Finished, its Log Entries show successful runs, and RT0012 events for that table stop or drop sharply.

Sources & References

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.

We respect your privacy. No spam. You will only be contacted when pilot slots open for your stack.