Introduction
When importing records from another system or Salesforce org, you can set audit fields using Data Loader.
These audit fields include Created By, Created Date, Last Modified By ID, and Last Modified Date. This feature ensures that historical data remains intact when migrating records.
Things To Know Before Proceeding
To set values for audit fields during record creation, ensure you have the required permissions and features enabled.
Refer to the Enable ‘Create Audit Fields’ article for details. Note that these fields can only be set during record creation and not during updates.
Exporting Data from the Source System
If you are migrating records from another CRM or Salesforce org, follow these steps to extract data:
Open Data Loader.
Click Export All.
Log in using the credentials of the source org.
Select the object you want to export (enable Show all Salesforce objects to view custom objects).
Click Browse, select a folder to save your exported file.
Select All Fields to ensure completeness.
Click Finish and confirm the operation.
Once the export is completed, open the CSV file to edit the audit field values.
Preparing Data for Import
Before uploading data into Salesforce, ensure:
Custom Fields exist in Salesforce if additional data needs to be captured.
Date and Time Format is correct for
Created Date
andLast Modified Date
. Format GuideUser ID Mapping: Populate
Created By
andLast Modified By
fields with the correct User IDs from the target org. Find User IDAudit Fields Can Only Be Set on Insert: Updating existing records with audit field values is not supported.
Importing Data into Salesforce
Once your data is formatted correctly, follow these steps to insert records using Data Loader:
Launch Data Loader.
Click Insert.
Log in using the target Salesforce org credentials.
Select the object for import (enable Show all Salesforce objects to view custom objects).
Click Browse and select the prepared CSV file.
On the “Initialization Succeeded” pop-up, click OK.
Choose Existing Mapping or Create/Edit a Map, or use Auto-Match Fields to Columns and make manual adjustments if needed.
Ensure that audit fields (
CreatedDate, CreatedById, LastModifiedDate, LastModifiedById
) are correctly mapped.Click Next and then Finish.
Confirm the process by clicking Yes on the pop-up message.
Repeat these steps for all objects you need to migrate.
Conclusion
Using Data Loader to set audit fields helps maintain data integrity when importing records.
By carefully preparing your CSV file, mapping fields correctly, and following best practices, you can ensure a smooth data migration process.