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
Gargi ManjeeGargi Manjee 

How to resolve following error: 'Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.' ?

Recently we have integrated data sync to Salesforce from another platform using thier API's. While running the data sync we encounter the following issues while inserting few records:

Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.

Kindly help with following questions:
1. What are the reasons for this issue
2. Whats design change required to resolved this issue.
Best Answer chosen by Gargi Manjee
Gargi ManjeeGargi Manjee
Hello Everyone,

If your record is Master in Master-Detail relationship and have roll up on child records, accessing master record while updating any child record will give this error.

This is not a very intuitive situation to debug. But figure after scrolling through lot of debug logs.

Just in case anyone looking for this answer.

Regards,

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi,

This basically happens when there is a conflicting modification being done by other user/process on a particular record that you are trying to access. Mostly it will happen when any kind of batch process is running in the background and locked the particular record you are trying to access(in your case Account). To get rid of this problem, you would need to check if there are any scheduled apex classes running in the background on Accounts/Cases and see if there is anything you can do to optimize the code to avoid conflicting behavior.


For further reference check this,

https://trailblazers.salesforce.com/answers?id=90630000000hYbAAAU


If it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
 
Gargi ManjeeGargi Manjee
Hello Everyone,

If your record is Master in Master-Detail relationship and have roll up on child records, accessing master record while updating any child record will give this error.

This is not a very intuitive situation to debug. But figure after scrolling through lot of debug logs.

Just in case anyone looking for this answer.

Regards,
This was selected as the best answer
sohail shaikh 32sohail shaikh 32
Hi,
This error comes when we use 'FOR UPDATE' keyword in our SOQL query. 

Example: [SELECT Id, Nam FROM Account  limit 10 FOR UPDATE]

FOR UPDATE keyword locks the queried records from being updated by any other Apex Code or Transaction. When the records are locked, other User cannot update them.