I am getting below error on a custom field on the Account object during deployment.

unable to obtain exclusive access to this record

Why am I getting this error?

2 Answers 2


This is because of record locking. From the Salesforce Developer site:

This is something temporary and would be fixed automatically in 10-15 minutes maximum.

Some common causes are:

  1. Sharing Rules are being calculated.
  2. A picklist value has been replaced and replacement is in progress.
  3. A custom index creation/removal is in progress.
  4. Most unlikely one - someone else is already editing the same record that you are trying to access at the same time.

Basically, whatever record it is that you're trying to manipulate is currently in use for the above reasons. Once it's no longer in use, it should become available for you to manipulate.

Without knowing what's in your Change Set however, there is one (painful) option from the Dev Boards:

The solution is to deploy different elements of your package in order until it is all complete. I've compiled a list of the components that I had to deploy, and put them in order. (I printed them up and put them on my desk... :P )

Anycomponents that you need to deploy that are not on this list, you can probably figure out how to make it work. If not, get in touch with SF support right away, and they'll get it worked out.

The list:

  1. Deploy objects: Custom, and changes to any others. As well as any custom "help pages" (if any)

  2. Deploy tabs, related documents, Applications

  3. Deploy Triggers, and test Trigger classes

  4. Controllers, test controller classes, components, related classes*

  5. VF pages

  6. Layouts

  7. Email templates

  8. Workflows

  9. Reports

  10. Dashboards

Long story short, if you haven't waiting and you're still getting this error. You might need to deploy metadata separately.

Edit After a bit of searching, I found this article.

It turns out that:

if you modify the format of an auto-number field - say, change the name from "C-{0000}" to "CDM-{0000}" - subsequent deployment of that object will fail if any test methods insert records of that object.

It seems what you need to do is:

  • Match up all auto-number field formats in your source & destination orgs
  • Re-run the full ant script (with all objects) again

Let me know how this goes.

  • I am deploying the fields
    – dem
    Commented Oct 19, 2016 at 12:08
  • @dem Has someone else has done a deployment at the same time, or that you've submitted multple deployments and they're overlapping each other? Have you tried waiting 15-30 minutes and tried again?
    – Dan Jones
    Commented Oct 19, 2016 at 12:15
  • @dem See my edits.
    – Dan Jones
    Commented Oct 19, 2016 at 12:29
  • Yes .There is no other deployment was going and i tried multiple time to deploy ,but same error is coming
    – dem
    Commented Oct 19, 2016 at 12:31
  • @dem Did you try auto-number matching? Take a look at the article linked.
    – Dan Jones
    Commented Oct 19, 2016 at 12:33

The root cause for us was a lookup to User on the Contact object.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .