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
AntigoniAntigoni 

Salesforce lock record or table

Hello there,

We've been having a problem in out org lately, getting an exception from test classes that are retrieving via SOQL the standard salesforce pricebook.

The exception is 'UNABLE TO LOCK ROW', for more info see the following link: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_concepts_core_data_objects.htm

Also the exception is thrown on inserting a pricebookentry, which is using the standard pricebook ( child to parent ).

After a lot of research we realised that deleting a lot of opportunities, which are also children to pricebook, is creating the locking problem with the classes.

We have indications that Salesforce is locking the standard salesforce pricebook record, as part of the 'data skew problem' : https://developer.salesforce.com/blogs/engineering/2013/04/managing-lookup-skew-to-avoid-record-lock-exceptions.html?language=en

We also have indications that Salesforce might be locking an entire table (pricebookEntry or Pricebook), as part of sync with Zuora from which the opps deletion is happening.

It is unclear to me, which of the 2 is happening, so my question is, is Salesforce able to lock an entire sObject table, or can it just lock a single row ?

 

Thanks in advance !

Best Answer chosen by Antigoni
ShashForceShashForce
Hi,

Locking an entire table should not be the case, I don't believe if it is even allowed in Salesforce.

Thanks,
Shashank