Sub topic 2
Matching Existing Records and Avoiding Duplicates
Assume you know Salesforce objects, records, and fields, and can edit CSV files. Before importing, decide whether each row should create a record, change an existing record, or be rejected as a duplicate.
Match Records Before You Insert
The Data Import Wizard can match records using fields such as a record name, email address, or an external ID. Duplicate rules may warn about or block possible duplicates. Review the proposed matches before starting the import.
Data Loader does not provide the same interactive duplicate review. Use Salesforce record IDs or a unique external ID column. Export the existing records first so you can compare keys and create a backup.
SELECT Id, Name, Phone, Industry
FROM Account
WHERE Industry = 'Energy'Install Data Loader and Log In
Data Loader is a desktop client for larger or more controlled jobs. Download it from Salesforce Setup, install it, and start the application. Select the appropriate login method:
- Use production login for a production org.
- Use sandbox login for a sandbox.
- Authenticate with your Salesforce credentials and security token, or use the available OAuth login flow.
- Confirm that your user has the object permissions and API access required for the operation.
A sandbox is the safer place to test mappings and validation rules.
Run Data Loader Operations
| Operation | Key column | Result |
|---|---|---|
| Insert | Fields needed by the object | Creates new records |
| Update | Salesforce `Id` | Changes existing records |
| Upsert | `Id` or an external ID | Updates matches and inserts nonmatches |
| Delete | Salesforce `Id` | Removes records |
| Export | SOQL query | Saves selected records and fields |
For delete jobs, export the target records first and test with a small sample.
Map CSV Columns to Fields
During a Data Loader job, map each CSV header to a Salesforce field. Automatic mapping works when headers match field API names. Otherwise, map columns manually. Check required fields, picklist values, date formats, and relationship fields such as Account__r.External_Id__c.
Id,Phone,Industry
001XXXXXXXXXXXXXXX,555-0199,Energy
001YYYYYYYYYYYYYYY,555-0198,RetailExercise
Which operation should update matching records and create records when no match exists?
Show answer
Use upsert with a Salesforce ID or a unique external ID.