Data Loader and data migration practice
Data Loader vs Data Import Wizard, Bulk vs SOAP mode, the command line for repeatable loads, external IDs and load order, automation bypass, and a migration runbook.
Simple explanation
Data Import Wizard (in Setup): browser-based, for simple imports of common objects up to about 50,000 records, with basic duplicate checking.
Data Loader (desktop client from Salesforce, macOS and Windows): insert, update, upsert, delete, hard delete and export (including exportAll) for any object, typically from 50,000 up to about 5 million records per operation. Salesforce supports only the latest version, so keep it updated.
- Modes: SOAP API (smaller batches, immediate errors) or Bulk API (large volumes; serial mode to avoid locking).
- Command line (
processwith configuration files) for repeatable, scripted loads in a migration pipeline. - Authentication through OAuth with the org's login (an External Client App or the standard Data Loader app, depending on org policy) β verify current sign-in method.
Migration practice
- Map and cleanse in a staging area, not in Salesforce.
- External IDs on every migrated object (
Legacy_Id__c, unique) so reruns upsert instead of duplicating, and children reference parents by external ID. - Load order: users β accounts β contacts β opportunities β line items β activities β files.
- Bypass non-essential automation for the migration user (trigger framework bypass, flow entry criteria).
- Defer sharing calculations for big ownership loads where supported.
- Rehearse in a full-copy sandbox, time each step, and reconcile counts and totals.
Real-world analogy
The Import Wizard is a hand truck: perfect for moving a few boxes. Data Loader is a forklift: anything, in bulk, but it needs a trained driver and a plan for where every pallet goes. The command line is the forklift on an automated schedule.
Worked example
A Data Loader command-line process for a nightly contact upsert (configuration excerpt):
<!-- process-conf.xml -->
<bean id="contactUpsert" class="com.salesforce.dataloader.process.ProcessRunner">
<property name="name" value="contactUpsert"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.entity" value="Contact"/>
<entry key="process.operation" value="upsert"/>
<entry key="sfdc.externalIdField" value="Legacy_Id__c"/>
<entry key="sfdc.useBulkApi" value="true"/>
<entry key="sfdc.bulkApiSerialMode" value="true"/>
<entry key="process.mappingFile" value="/opt/migration/maps/contact.sdl"/>
<entry key="dataAccess.name" value="/opt/migration/data/contacts.csv"/>
<entry key="dataAccess.type" value="csvRead"/>
<entry key="process.outputSuccess" value="/opt/migration/logs/contact_success.csv"/>
<entry key="process.outputError" value="/opt/migration/logs/contact_error.csv"/>
</map>
</property>
</bean>
Run it with the process script, passing the configuration folder and process name β verify the script name for your installed version.
Diagram
Key points
- Import Wizard for small, simple imports; Data Loader for any object and large volumes.
- Data Loader Bulk mode (serial when locking) and command line for repeatable loads.
- External IDs everywhere; children reference parents by external ID.
- Load order, automation bypass, sharing deferral.
- Rehearse in a full sandbox and reconcile afterwards.
- Keep Data Loader updated: only the latest version is supported.
Limits and gotchas
- Data Loader runs automation (triggers, flows, validation) unless you bypass it. A load can send thousands of emails if workflow or flows send them.
- Time zones: dates in CSVs are interpreted using the loader's settings; set them explicitly.
CreatedDateandCreatedByIdcan only be set on insert with the Set Audit Fields upon Record Creation permission.- Hard delete skips the recycle bin and needs a separate permission.
- Very large migrations often use an ETL tool or middleware on Bulk API for scheduling, transformation and restartability.
π€ How to say this in an interview
"How would you migrate 10 million records from a legacy CRM?" is classic. Give the runbook: staging, external IDs, load order, bypass, sharing deferral, rehearsal with timings, reconciliation, cut-over and rollback plan. Mention the tool last.
Common follow-ups
How do you keep historical created dates during migration?
Enable the 'Set Audit Fields upon Record Creation' permission for the migration user, map CreatedDate and CreatedById on insert (owner and created-by users must exist), and turn it off afterwards.
A load fails halfway. How do you restart safely?
Because every record has an external ID, rerun the same upsert: successful rows update in place, failed rows insert. Fix the errors from the error file first, and check that automation doesn't double-fire on updates.