OBLYTECH Logo
OBLYTECH Logo

Bulk API 2.0 for Large Salesforce Data Migrations: Fit and Planning

Bulk API 2.0 fits large or frequent bulk changes in Salesforce, such as a migration that moves thousands of records in one run. The initial bulk load needs its own plan, because its volume, timing, and failure handling differ from the singleton updates that integrations make one record at a time. Plan the load before choosing the tool.

Where Bulk API 2.0 fits in a data migration

Bulk API 2.0 is built for work that touches many records at once. Moving account, contact, or product history from a legacy system into Salesforce is a common example. Recurring bulk changes also fit, such as a nightly refresh of a reference table or a clean-up that corrects thousands of owner assignments in one pass. For the wider scope of this kind of work, see data migration and integration.

Bulk work runs asynchronously. A job you submit hands the work to the platform, and you read the outcome once it finishes. Your team needs a way to collect those results, match each one back to its source record, and decide what to do with rows that failed.

Bulk API 2.0 is a poor match for work where a user waits on the answer before the next screen loads. Asynchronous processing carries no fixed response time, so an action that a person must finish before continuing belongs on a synchronous call. Keep single-record edits from the user interface on standard APIs, and reserve the bulk path for batch work.

Separating the initial load from ongoing integration

The initial bulk load and the ongoing integration are two projects that happen to share a tool. The load is a one-time or scheduled process that moves a full history into the org. The integration is a stream of changes that should reach Salesforce as they happen. Mixing them into one design tends to let the load’s volume dictate the integration’s timing, or to apply the integration’s retry rules to a load that needed a different approach.

Give the load its own plan, with its own owner, schedule, and cut-over point. Decide which system is the source of truth for each object before the first job runs. Write down the cut-over moment, after which new changes flow through the ongoing integration instead of the load. A gap or an overlap at that point creates duplicate or stale records that are hard to trace later.

Singleton updates scale poorly with volume. A process that sends one record per call is easy to build and trace, but at large data sizes it can use up daily API allowances quickly. Count the expected daily calls for each path before choosing one.

Mapping source records and external IDs before the first job

Map each source record to its Salesforce target before any job runs. The mapping sheet should name the source key, the target object, the external ID field used for upserts, and the person who owns that field. Keep the external ID stable across the load and the ongoing integration, so that a re-sent row lands on the same record in both.

Check the conversions that are easy to overlook. Date and time values need one time zone convention. Picklist values need an agreed list of valid labels. Owner and user assignments need active users in the target org. Duplicate keys in the source extract should be resolved in the source, not left for the platform to reject.

Planning volume, timing, and daily execution counts

Start with three numbers: the record count for each object, the number of times each load or sync runs in a day, and the latest acceptable time for the data to be complete. Those figures decide which tool and which pattern fit. A one-time load of a full contact history over a weekend calls for a different design from a sync that updates a small set of records each hour.

Next, ask how quickly results must be available. Asynchronous results can arrive almost at once or take minutes or hours, and no service level fixes the time. Schedule the final job so that a downstream team’s deadline still leaves room for one re-run.

Finally, ask what a spike would do. A cut-over weekend, a month-end import, or a faulty upstream feed can push volume well above the normal pattern. Decide whether jobs queue or slow down under that load, and who gets alerted when the queue grows past an agreed threshold.

Checking governor limits and failure handling

Before any job runs, check the org’s governor limits and licensing-based capacity against the expected load. Governor limits apply to the code and processes that touch the data, including the bulk path. A load that triggers heavy automation can hit a limit even when the API call itself is comfortably within its allowance. Run a sandbox rehearsal first and read the limit usage it produces.

Plan for retries. Bulk tooling includes retry behavior, so plan for a row to be sent more than once after a timeout or a partial failure. Use a stable external ID so that a re-sent row updates the existing record rather than creating a second copy. In practice, an upsert keyed on an external ID is the usual way to make a load safe to re-run.

Decide how a failed row should affect the rest of the job. Some APIs expose an all-or-none setting that rolls back a whole request when one row fails. Check whether the tool you choose supports that behavior and at what level, then pick the setting that matches the data’s tolerance for partial loads. A partial load may be acceptable for a reference table and unacceptable for an account hierarchy.

Running a load in stages

Run the migration in stages, and give each stage a clear pass or fail test.

Stage one: sample and reconcile

Load a small, representative sample into a sandbox. Include the awkward records: missing required fields, unusual characters, duplicate names, and records related to other objects. Count the records created, updated, and failed, and reconcile those counts against the source extract. Each failure should carry a reason that someone can act on. A sample that loads without errors but cannot be reconciled has not passed.

Stage two: rehearse the cut-over

Repeat the full load in a sandbox that matches production as closely as you can. Time it. Record how long the load takes, how many jobs it runs, and where the queue grew. Use those numbers to set the production window and to decide how much slack to leave for a re-run.

Stage three: load production and verify

Run production inside the agreed window, then reconcile the record counts again and spot-check a set of records against the source. Keep the failed-row file and the job results for the audit trail. Hand the ongoing integration the cut-over point you wrote down earlier, and confirm that the first changes after cut-over arrive once, without duplicates. If the project needs help planning this sequence, see Salesforce implementation.

Reading job results and closing out a load

Each job produces a results output that lists each row and whether it succeeded. Read the failed rows as a group before retrying anything. Failures tend to fall into a few families: a required field is missing, a value does not match the target field, a validation rule rejects the row, or a duplicate match blocks an insert. Each family has its own fix, and the fix usually belongs in the source extract rather than in the load script.

After the source is corrected, re-run the failed subset with the same external IDs so that rows which already succeeded are not duplicated. Record the job IDs, the counts before and after, and the cause of each failure family. That record lets someone else check the load later without repeating the investigation.

Choosing tools for the load and the ongoing sync

Bulk API 2.0 suits the bulk load and large recurring batches. Point-and-click import tools suit data stewardship and occasional fixes rather than the base of an ongoing integration. An integration platform or middleware suits the ongoing sync, especially when several systems are involved. If an organization already runs an ETL or middleware platform, consider it for the load before building a new path.

For a side-by-side view of the loader options used in migrations, read choosing Salesforce data loader options for migration. For how the ongoing integration should be structured across systems, the Salesforce integration architecture page covers the design side. Where the load has to trigger downstream processes, the Salesforce automation workflows page explains how those steps fit together.

Questions about planning a bulk data migration

Who should review the failed-row file after a load?

The owner of the source data should review it, because many failures trace back to values in the extract. The Salesforce administrator usually owns the field definitions that caused a rejection, so the two should review the file together. A load script that patches values silently hides the problem from the people who can fix it upstream.

In what order should parent and child objects be loaded?

Load parent records first, then the children that reference them. Keep the parent’s external ID in the child extract so the relationship can be set without looking up a record that may not exist yet. Run that order in the sample stage, so that a missing parent shows up well before the production window.

Does the source system need a change freeze during cut-over?

A short freeze, or at least a clearly recorded cut-over timestamp, reduces stale data. Without one, changes made in the source after the extract was taken will not reach Salesforce unless the ongoing integration picks them up. Decide which approach fits before the window.

What should the audit trail for a bulk load contain?

Record the source extract version, the mapping sheet version, the job IDs, the record counts before and after, the failed-row file, and the cut-over timestamp. Store the trail with the project notes so the next person can answer a question about a record months later.