Heroku Connect Maximum number of duplicate updates in one batch

Issue

My Heroku Connect mapping is getting Maximum number of duplicate updates in one batch errors. How can I stop this?

Resolution

The "Maximum number of duplicate updates in one batch" error is encountered when too many updates to a single record occur in a batch. When we batch updates, we attempt to limit the number of duplicates for a single record_id / table_name pair. The limit actually applies both to Bulk updates and SOAP updates.

When your object has an Apex Trigger or a Workflow, that can generate further updates that will count against the Salesforce API limits and can push you over the limit even if updates from the _trigger_log would not have done so. To try to avoid this, we actually limit to 10 updates per record instead of 12, but in some cases Apex Triggers and/or Workflows will still push your update over the limit.

When we do encounter this error, we force the update to use SOAP instead of the Bulk API, which can take much longer but generally avoids the error. The sync will still complete at the cost of performance.

The best way you have to avoid this is to not have rapid updates to the same object. Sometimes this can be accomplished using a "staging" table which has a similar schema where you make updates until the record is in a good state to sync, then move it to the mapped table. You can also avoid patters like this pseudocode in your application:

model.attr = value
model.save
model.other_attr = value
model.save
# ...

Avoiding frequent updates to a single object and avoiding Apex Triggers / Workflows are the best things you can do. Unfortunately, this limit is on the Salesforce side and is not configurable, so you won't be able to have it raised either.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2018 Salesforce.com