Salesforce Developer Interview Question

Users and integrations are hitting UNABLE_TO_LOCK_ROW errors. What causes it, and how do you fix it?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Salesforce locks a record while it is updated, and often locks its parent too, for example when children affect roll up summaries or sharing. Errors appear when many transactions touch the same records at once, typically from data skew, such as tens of thousands of contacts under one account, or from parallel batch jobs and integrations updating related records. Reduce contention by spreading data, grouping or serialising updates, and retrying.

Why interviewers ask this

Record locking errors appear as data volumes grow, and they are often misdiagnosed as random platform problems. The interviewer wants to see that you understand parent locking, data skew and concurrent processing, can find the records at the centre of the contention, and know the practical fixes. Knowing that one placeholder account holding thousands of child records is a classic cause shows you have dealt with it in a real org.

How to structure your answer

  • Explain record and parent locking.
  • Identify the usual causes, especially data skew.
  • Find the contended records from logs and timing.
  • Apply fixes: spread data, serialise work and retry.

Example answer

Spoken example, first person

When a record is updated, Salesforce locks it until the transaction commits, and updating a child often locks the parent too, for instance in master detail relationships. The error means one transaction waited too long for a lock another held, so I look for many transactions hitting the same records at the same time. The classic cause is data skew. On one org every unassigned contact was parked under a single placeholder account, tens of thousands of them, so parallel contact updates fought over one parent lock. The other common cause is concurrency we create ourselves, such as parallel batch jobs or an integration running several threads, each updating children of the same parents. To find it, I check the failing records for a shared parent or owner. The fixes are spreading skewed data across several parents, sorting batch input by parent id so each parent lands in one chunk, reducing parallelism in the integration, and retrying after a short delay for the occasional collision.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What is ownership skew, and why does it cause problems?
  • How would you safely retry a failed update in Apex?
  • How would you restructure the data behind that placeholder account?

Related salesforce developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot