6

One of user from my org got this error while changing an owner of Account. (there is a trigger on Account who updates its child opportunities too ) Now I am unable regenerate the error.

enter image description here

So my question is - Is my account Record is Locked ? What could be the possible solutions OR Any list of Check points which I should go through ? Any suggestions ?

3
  • Have you managed to replicate the error? Jan 12, 2015 at 15:08
  • No, I didn't @MihaiNeagoe Jan 13, 2015 at 4:21
  • I'm trying to update a user object and it seems to be permanently locked... Going on 30 minutes and still can't update it
    – NSjonas
    Apr 20, 2017 at 4:53

2 Answers 2

7

There are two errors possible in APEX about concurrency:

  1. EXCEPTION_THROWN[32] System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.
  2. FATAL_ERROR System.DmlException: Update failed. FIrst exception on row 0 with id ............; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []

If two users try to update an account at once, when the second user tries to save the data, the error message in your question will be displayed in the Salesforce user interface.

When the second user tries to update the account, the system detects that the account has been updated by another user since the edit session began and blocks the update. Salesforce is using a type of record locking approach called optimistic record locking which is not at the database level.

This concurrency locking only applies to different users. If you have two asynchronous or external service calls running in the same user context and a concurrency issue comes up, it will not be detected.

That might explain why you couldn't replicate the issue with code.

5
  • @Neagoe : Yes its is but obvious that same time 2 user cant access the same record - one will lock it to maintain ACID properties, but As per discussion with Seniors and clients, Its clear that they are facing same issue many times. and there is -- Lock-- on the record, Are you sure that your answer - "Trying to save record which is in use by other user" . Jan 9, 2015 at 10:28
  • 2
    The second user can still access the account even if another user is in edit mode. The problem comes when the second user tries to edit and update/save the record when the first user is still in the edit session. Like I said in my answer this error is not at the Database level, it's coming from the Salesforce interface. Was that your question? Jan 9, 2015 at 10:32
  • Yes that's exactly I wanted to be sure on. By the way I found too many people on the SF community facing the same error and they raised Case Ticket with Salesforce and all. I was wondering my problem might also be in that category - but I am not sure --- See here success.salesforce.com/issues_view?id=a1p30000000T3YzAAK Jan 9, 2015 at 10:36
  • It`s unlikely as the error has been patched in Winter '14. And has been fixed on all the instances, production and sandbox. You could test the scenario by trying to edit the same account record with two different users and see if you can replicate the error. Jan 9, 2015 at 10:39
  • ok, I'll look into it and will post ASAP Jan 9, 2015 at 10:41
4

I've gotten the "Record Currently Unavailable" error when saving records while doing a check-only deploy. I've had users report it during multiple deployments, and only during these deployments, so I'm fairly confident that the deployment is the cause.

There was known issue that was fixed in Winter '15, but I've gotten the error in Winter '16.

1
  • Gosh! Still having the same issue in Spring 17!!!!!!!
    – Patlatus
    Feb 16, 2017 at 16:05

You must log in to answer this question.

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