I have an intermittent error that happens sometimes 3 times a week and sometimes not for a couple of weeks. Each time, it is from a different user. I get an email produced from the catch try block which is not very useful.

This has happened to different users and seems random. For me to debug it, is there a better way than tracing all users daily?

| improve this question | | | | |
  • Update the catch block to record more helpful information (appreciate code changes may not always be easy) – Girbot Jan 24 '19 at 17:25
  • @girbot Is there a way to see all the other processes flowing. My finest debug log does not show any other process that could be locking the Parent record of the Child record I am inserting. – disasterlooms Feb 8 '19 at 17:31

That's not practical. The 250 MB log limits means you'd run out in hours at best, possibly even minutes. You're going to have to read the code, figure out what's wrong, and fix it. We can try to help you if you post a new question with the code, a brief explanation of the problem, and any other relevant data you think might help.

| improve this answer | | | | |
  • The error is unable to lock row. The part I am stuck is finding what process is locking the row. The error happens on inserting a child record for the opportunity. The child record is a junction object between Account and Opportunity. I have removed all roll up summaries to ensure that changes there are not triggering anything. In the finest debug log, I do not see any other apex or worflows that would lock the Account when inserting a Child record from an opportunity trigger. – disasterlooms Feb 8 '19 at 17:30
  • @disasterlooms I presume this has a master-detail relationship? If so, then the locks on the parent happen automatically anyways (including the account). That's because things like sharing and so on have to be calculated, too. These are notoriously hard to replicate, and debug logs probably won't help you. You might try engaging support, they have additional things like server logs they can look in. – sfdcfox Feb 8 '19 at 20:02
  • yes, it is master detail. I think you are correct. We recently updated sharing rules and the errors started to show way more often since that change. I will contact salesforce. thanks – disasterlooms Feb 10 '19 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.