0

Our Contact model is Private and there is a relationship with the Account object but it is a Lookup and NOT Master-Detail. We also have a custom setting which makes sure that not Triggers are running when an Informatica user is making inserts/updates to Contact records.

We have nightly Informatica job that Inserts/Updates Contact object and we are getting errors like this: SalesforceConnection_10040 [ERROR] Unable to insert following row into target: [7501G00000F9DyHQAV,7511G00000O8gQTQAZ,,false,false,UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 1 records: 0010000000...:--,0031G00000z...,0010000000...,...]

My question is why Account needs to be locked if we are making Contact updates? The relation is lookup so there is no need to recalculate sharing, correct? There is a PB on Contact but it is launching a flow that updates a User record. And for a handful of Contacts that I checked (based on the OO3 id in the message) does not even trigger because of the RecordType filter.

Any ideas for what I need to check next?

1

As stated in Avoiding Deadlocks, Salesforce will:

  • First locks sObject parent records, then children.
  • Locks sObject records in order of ID when multiple records of the same type are being edited.

We are not told why this is the case, but this is the case. Parents are always locked before their children. If you're running jobs in parallel, try to sort the jobs by AccountId and attempt to avoid having more than one transaction per AccountId when possible. With some careful arrangement of the data, you can prevent row lock errors.

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.