To import activity records (Tasks and Events) into Activity History, you need to import Tasks with a "Completed" status or events that have occurred in the past since this is what determines whether an activity falls under Open Activities or Activity History.
When importing activities into Salesforce there are associations that need to be made to relate the activity to other object's records and user records.
Preparing the .CSV file:
Your CSV file should contain the following columns to properly relate the activities to existing records in Salesforce:
- WHOID: Sets whether the task will be associated to a Contact or a Lead
- WHATID: Associates the task with an Opportunity or an Account
Note: If you are setting a lead record as the WHOID, it is not possible to set a value for the WHATID field
- OWNERID: Maps to the "Assigned To" field
- Status: Only include this column when inserting Tasks and set it to Completed for the record to appear under Activity History
- StartDateTime and EndDateTime: Only include these columns when inserting Events. Events that have a Start and End date/time in the past will automatically be placed into the Activity History related list. Review the field description for each of these in the Event object's documentation for special considerations and What is the format for Date and Date/Time values through the API or Data Loader? for their format.
- Subject and optionally the Description field. For a full list of available fields refer to the SOAP API Developer Guide's Event and Task object documentation.
For all of the previous relationships you must use the unique record Id to make a successful association. Because a lookup relationship is being created, simply inputting the record name will not work. You can get the Ids of the associated records by running and then exporting a report that included the Record Id column.
Inserting the records:
1. Log in to the Data Loader
2. Choose Insert
3. Select Tasks or Events accordingly.
4. Locate the csv. file created on the first step
5. Click "Create or Edit a map" and map the Salesforce fields to the columns in your file
Insert, Update, or Delete Data Using Data Loader
How do I add existing record's Salesforce Ids in my import file?
How to create a Recurring Event or Task with Data Loader