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
RoboRobo 

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record

For the last few days on the Force IDE when I try to deploy my files to the server I keep getting:

Save error: unable to obtain exclusive access to this record

Best Answer chosen by Admin (Salesforce Developers) 
IspitaIspita

Hi Robo,

You say that the error is encountered during deployment of your code via Force.com IDE , which implies perhaps there's a Test Class - which is doing some data operations which subjects data/ records to simultaneous operation by code/ triggers -try modifying your test classes with this point in mind -" Structure Data creation ina way that recursion or circular referencing of data is avoided" . That might solve your problem.

Alternatively you might try deploying your code in small packets to avoid firing of multiple classes ( Try change sets - though technically its same as IDE propelled deployment) - so the catch is to split or structure your test classes to avoid recurssion.

 

Hope this answers your query.. 

Thanks...

All Answers

IspitaIspita

Hi Robo,

You say that the error is encountered during deployment of your code via Force.com IDE , which implies perhaps there's a Test Class - which is doing some data operations which subjects data/ records to simultaneous operation by code/ triggers -try modifying your test classes with this point in mind -" Structure Data creation ina way that recursion or circular referencing of data is avoided" . That might solve your problem.

Alternatively you might try deploying your code in small packets to avoid firing of multiple classes ( Try change sets - though technically its same as IDE propelled deployment) - so the catch is to split or structure your test classes to avoid recurssion.

 

Hope this answers your query.. 

Thanks...

This was selected as the best answer
RoboRobo

Thanks, that fixed it.  Tests were causing circular reference.