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
BobPBobP 

Flow: UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record

I have a flow that is sometimes generating
the UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record.  I don't know if there is something I can update to my flow to ignore any apex batch jobs etc or to change my flow.  Below is the update that is throwing the error.

User-added image
BobPBobP
Can a Contact formula in an apex class SOQL for an update cause this error?
mukesh guptamukesh gupta
Hi Bob,

For consistent data, when a record is being created or updated, it is locked so that other users cannot update the record.

FOR UPDATE keyword in SOQL helps us to lock the records from being updating from another request. Sample Code
http://www.infallibletechie.com/2015/05/how-to-lock-records-using-apex-in.html

Locking Issue may happen due to Skewing issue - http://www.infallibletechie.com/2019/11/salesforce-data-skew.html

Salesforce Reference Link - https://help.salesforce.com/articleView?id=000338933&type=1&mode=1 (https://help.salesforce.com/articleView?id=000338933&type=1&mode=1)

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh 
BobPBobP
Hi Mukesh,

Thank you for helping.  It appears that the Status field on Service Appointments is the issue. Since it is a standard field. I can't see where else this field is used in any other automation. Is there any way to see where this field is being used by querying flows or apex classes, etc. Or would adding a default variable to the below screenshot an option.

I'm not sure how to stop this from happening, but it is frustrating my community and internal users. 

User-added image

 
BobPBobP
Quick Question   Do formula field ever play apart on the row locking error?