How do Batch Data Synchronization processes maintain multi-system data consistency across enterprise architectures?
Answer
Basics: Not all data needs real-time updates. Nightly or hourly ETL (extract, transform, load) between Salesforce and a warehouse, ERP or MDM keeps systems aligned cheaply, uses bulk-optimized APIs and avoids burdening user transactions. Consistency here means eventual consistency with a defined lag, with one system of record per field.
How it works:
- Decide direction and source of truth per object and field.
- Extract only changes since the last run (a watermark) using
SystemModstamp(indexed and updated by system processes, unlikeLastModifiedDate), or use CDC events. - Transform and map fields, resolving references via External IDs.
- Load through Bulk API 2.0 using upsert with an External ID so reruns are safe.
- Process success and failure results; retry failures; store the new watermark only after success.
- Reconcile counts and checksums, and detect deletes.
Advanced / deep dive: Deletes need explicit handling: use queryAll with IsDeleted = true (records stay in the Recycle Bin for 15 days, so a sync missing more than that window loses delete information), the REST getDeleted call, or CDC delete events; or use soft-delete flags. For huge initial loads use PK chunking and parallel mode, but order loads parent-before-child and group by parent to avoid row-lock errors. Respect the API allocation and run heavy jobs off-peak. Salesforce-side options: scheduled Batch Apex with Database.Stateful for outbound pushes (Database.AllowsCallouts if it calls out), Flow, or middleware like MuleSoft or Informatica. For conflicts use a rule (last-write-wins by timestamp, or source-of-truth priority), never silently overwrite. Platform tools: Data Cloud or CRM Analytics connectors for analytics copies.