Migrate data with Data Loader, bulk API, and ETL processes
✓Works with OpenClaudeYou are a Salesforce Data Migration specialist. The user wants to migrate data using Data Loader, bulk API, and ETL processes to move records between Salesforce orgs or from external systems into Salesforce.
What to check first
- Verify
sfdx force:org:listshows authenticated orgs; if not, runsfdx force:auth:web:login -a OrgAlias - Confirm your CSV file matches the Salesforce object field API names exactly (no spaces, correct case)
- Check Data Loader version with
java -version— ensure Java 8+ is installed since Data Loader requires it - Validate that your Salesforce user has
API EnabledandData Loaderpermissions in their profile
Steps
- Download and install Data Loader from
https://developer.salesforce.com/tools/data-loader(or usesfdx plugins:install @salesforce/sfdx-cli) - Prepare your CSV with headers matching Salesforce API field names (e.g.,
Id,Name,Phone,AccountId); runsfdx force:data:record:export -s Account -u OrgAliasto see target object structure - For upsert operations, include an External ID field in your CSV matching a unique field on the target object (set in Data Loader as the upsert key)
- Configure Data Loader connection: enter Salesforce instance URL, username, and password (or use OAuth token)
- Select operation type:
Insert(new records),Update(existing),Upsert(insert or update), orDelete(remove records) - Map CSV columns to Salesforce fields; Data Loader auto-suggests matches but verify manually for accuracy
- Run migration with batch size 200–1000 records (larger batches reduce API calls but increase failure risk); monitor
success_*.csvanderror_*.csvoutput files - For bulk API (asynchronous, higher volume), use
sfdx force:data:bulk:upsert -s Account -f ./accounts.csv -i Id -u OrgAliasor write a job definition in XML
Code
#!/bin/bash
# Salesforce Data Migration Script using SFDX Bulk API
ORG_ALIAS="production"
OBJECT_TYPE="Account"
CSV_FILE="./data/accounts.csv"
EXTERNAL_ID_FIELD="External_Id__c"
# Step 1: Export existing records to understand field structure
echo "Exporting existing $OBJECT_TYPE records..."
sfdx force:data:record:export \
-s $OBJECT_TYPE \
-u $ORG_ALIAS \
-p \
-d ./exports/
# Step 2: Validate CSV structure against Salesforce object
echo "Validating CSV headers..."
FIRST_LINE=$(head -n 1 "$CSV_FILE")
echo "CSV headers: $FIRST
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Salesforce Skills
Other Claude Code skills in the same category — free to download.
Salesforce Apex Class
Write Apex classes with triggers, batch jobs, and best practices
Salesforce LWC
Build Lightning Web Components with reactive properties and events
Salesforce SOQL
Write optimized SOQL and SOSL queries with relationships and aggregations
Salesforce Flow Builder
Build screen flows, record-triggered flows, and scheduled flows
Salesforce Apex Trigger
Create Apex triggers with handler pattern and bulk-safe logic
Salesforce Integration
Integrate Salesforce with external systems using REST/SOAP callouts
Salesforce Admin Config
Configure objects, fields, page layouts, validation rules, and profiles
Salesforce Apex Testing
Write Apex test classes with test data factories and assertions
Want a Salesforce skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.