Scenario: On update of a record, record data should be sent to external system. This can be achieved by platform events or outbound messaging or by rest/soap callouts.

But if there is a bulk update, say 1million records of an object and then on update, data should be sent to external system.

What would be the best way to achieve this? Would any of these approaches(PE/outbound/callout) will cause considerable on-going traffic between the two systems? Is using a third party tool to implement change data capture for bulk updates along with platform event for single record update a good solution?


1 Answer 1


Multiple options:

Batch class callout

You can use

Database.GetUpdatedResult r = Database.getUpdated(
   'Object API Name',

and send the records to the external system via callout in batches of 100, as there is no limit on ApexCallout being made from apex, you can schedule this after the bulk update is done.

Cons Custom approach. Code maintenance. Security

Heroku Connect

Use Heroku connect to sync the data to a database hosted in Heroku. This internally uses Platform event or polling mechanism which is configurable. In you case polling for every 30 minutes should work fine. No code, Mostly configuration, secure.

Cons Skillset is required to run heroku and configure it.

Pull data via Bulk API

Have external System pull data from Salesforce as a nightly job. While doing a bulk data load mark the records with a flag which needs to be sent to external system. Then you can query the data via bulkapi BulkV2QueryJobs and fetch the data.

Cons: Not sure

CDC or Platform Events

This may work on small set of data, but it has will fail with Large data volumes, as these are have same limit of delivery. And will have to incur additional costs to support for huge data sets, as the default limit is very less. By default this is Secure and Scalable. But Scalable with a cost.

Cons: Costly, and not reliable as the events might get lost in a server failure scenario.

  • Thanks @Nagendra for your answer! In Batch class callout, would you suggest one callout per record or callout per 100 records i.e. callout per batch and sending a list of records in one callout.
    – devforce
    May 31, 2022 at 17:30
  • This would totally depend on your external system. How do they consume the data. But bulk would be better approach. 100 callouts are limit for each execute method. May 31, 2022 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .