How to fix UNABLE to obtain exclusive access to this record?
Unable to obtain exclusive access to this record error
- Sharing Rules are being calculated.
- A picklist value has been replaced and replacement is in progress.
- A custom index creation/removal is in progress.
- Most unlikely one – someone else is already editing the same record that you are trying to access at the same time.
What is ROW lock error in Salesforce?
For example, if two batches are being processed at the same time and the two of them contain records pointing to the same parent record, one of the batches will attempt to place a lock in the parent record, which can lead to the other batch throwing a “unable to lock row” error as the batch was not able to get a lock …
How do you lock and unlock records in Salesforce?
go to Setup | Search Automation Settings in the Quick Find box | click on Automation Settings. Then, select Enable record locking and unlocking in Apex. Let’s consider an example CPQ Quote object, to unlock records. First Query how many quotes created in a month.
What is granular locking in Salesforce?
By default, granular locking is enabled, which allows some group maintenance operations to proceed simultaneously if there is no hierarchical or other relationship between the roles or groups involved in the updates. External user creation requires locks only if new external roles are being created.
Why do I get the unable to lock row error?
UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 124 records… After the error there is a long list of Account record Id’s. All triggers are disabled. I am unsure why this is happening… Why am I getting this error? What can I do I better understand the error? How might fix it?
What does unable to lock row Mean in Salesforce?
The lock gets released when the transaction completes. When two users or two different apex code tries to update the same record, then salesforce throws an error “UNABLE_TO_LOCK_ROW unable to obtain exclusive access to this record”. Using FOR UPDATE keyword helps to achieve a lock a client end to prevent this locking issues.
How to check for unable to lock row in apex?
To start debugging the issue, create debug logs and also check Apex Jobs at the same time. Apex job will have asynchronous calls in your flow and must have some DML which is updating same record on which you are getting UNABLE_TO_LOCK_ROW error.
When do you need to lock a record?
When you have multiple jobs running that update the same set of records, it’s recommended to lock the records using the FOR UPDATE keyword. It will ensure that the record is locked and no other job can update the same record at that point in time.