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
krupananda reddykrupananda reddy 

" unable to lock the row " system exception

I have several triggers on User object and inturn the some handler classes related to triggers invoke future calls. But sometimes i see a strange exception like "Unable_to_lock_the_row" system exception. And i went through some the discussion boards on this but there is no exact resolution suggested for this.  Most likely the soltuion is none... http://www.slideshare.net/developerforce/concurrency-designpatterns-mt. 

If anybody has come across this sort of exception and could resolve it, please assist on this.

Many thanks in advance :)
ShashankShashank (Salesforce Developers) 
As explained in the slides, apex does not do optimistic locking. The only way is to anticipate and handle the exception. Here is an example: http://thysmichels.com/2014/01/15/unable_to_lock_row-solution-using-rerun-method/