How to set CreatedDate and LastModifiedDate while inserting Data using Data Loader in Salesforce?

1. Go to User Interface in Salesforce Setup.


2. Enable the check box Enable "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" User Permissions.


3. Create a Permission Set with "Set Audit Fields upon Record Creation" permission enabled.


4. Assign the Permission Set to the Data loading User.

5. In the import csv file, use CreatedDate and LastModifiedDate.

Sample CSV for Chat Transcript Object:
LiveChatVisitorId,Status,EndedBy,CreatedDate,LastModifiedDate
5718c000003xBvlAAE,Completed,Agent,2022-04-20T15:30:00.000+0000,2022-04-20T15:30:00.000+0000

Data Loader Field Mapping: