function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Volker_factory42Volker_factory42 

Getting Unable to Lock Row when executing Apex-Code

I'm getting an errormessage in a livesystem like the following:

 

System.DmlException: Update failed. First exception on row 0 with id a0z20000000I9HGAA0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record

 

This line which causes the error is doing an update to an objekt. This whole code is to complex to paste in here, but I can poste the progress:

 

This method is a future method: It's getting all data in a List, looping through every entry, change values, add to a new list, and after loop is closed it's updating to Database.

 

There is no trigger with before update or something else. 

 

Is there a special order to know for methods called as future?

 

 

 

kprkpr

Hi, Did you find a solution to this issue? I'm facing the same problem. My future methods are invoked from a before update trigger on Account though.

 

The future method collects all the child Accounts of the Account record that fired the trigger and updates them with certain values.

 

The problem occurs when the same Account is modified in quick succession.

 

Any pointers greatly appreciated!