Importing data into multiple salesforce objects

Apsona’s import facility can be used to import data records into multiple related objects with just a single CSV file. Here is a detailed example showing how to do this. This example shows importing Account and Contact records from one CSV file, but you can use a similar procedure to import into any pair of linked tables. Suppose we have a CSV file containing contact information, like this:

First name Last name Phone Email Company Company City
Joseph Stangerson 902 223 3344 Hope Corp Corinth
Enoch Drebber 902 223 3344 Hope Corp Corinth
Mary Morstan 816 333 4567 Sign Four Inc London
Thaddeus Sholto 816 333 4568 Sign Four Inc London
James Moriarty 666 645 4555 jim@mori.rty Advanced Concepts Reichenbach
Ronald Adair 666 645 4565 ron@mori.rty Advanced Concepts Reichenbach

And we wish to create both Account and Contact records from this single data set. We want the distinct company names and addresses to end up as records in the Account object, and we want the corresponding contact records to be linked to the account records. In the above example, we want three Account records (for the three distinct company names), each linked to two contact records.

Outline of steps #

  1. Import the CSV data into the Account object, rejecting duplicates. During this step:
    • Map the account-related columns in your CSV data to corresponding Account fields
    • Leave the contact-related columns unmapped.
  2. This will create the three account records. It will also produce an output CSV data file containing all of the data in the original file, but annotated with the record IDs of the three new account records.
  3. Use the output CSV data file from the above step to import into the Contact object. During this step:
    • map the account ID produced in the output of the Account import
    • Omit the mappings for the account-related fields, but map the contact-related fields to the corresponding salesforce fields.

This step will produce six contact records, linked to the accounts as desired.

Detailed description #

  1. Navigate to the Accounts tab and click Tools – Import/update. 
  2. The import wizard appears. Paste the CSV data into the box. (You can specify a file name for upload instead, if you choose.) Then click the “Next” button at top right. 
  3. The second step of the import wizard appears. In this step:
    1. Map the columns of the CSV data to fields in the Account object.
    2. Match the Account-specific columns (Company name and Company City) to the corresponding salesforce fields, and leave the Contact-specific columns set to “Do not import”.
    3. Set the “On data errors” option to “Omit erroneous records” so that duplicates are rejected.
    4. Click the “Next” button at top right.

  4. The third step appears, just before the actual import happens. This step shows the mappings you have set up, and the number of records that will be imported. Click the “Import” button at top right. 
  5. In a few moments the import is complete, and the “Download results” panel appears.
    1. Select the “All imported, updated and duplicate records” radio button and click the “download” button. This will download all the data records, with Account ID values attached.
    2. Click the Done button at top right.

  6. The downloaded CSV data looks like this. Notice that the account ID values are automatically propagated to all the “duplicate account” records. This will enable us to import the Contact records correctly. 
  7. Now use this CSV data to import into the Contact table. As before, click Tools – Import/update in the Contacts tab. 
  8. In the first step of the import wizard, provide as CSV data the downloaded output from the Account import. Click the “Next” button at top right. 
  9. In the next step, map the contact columns in the data to corresponding fields in salesforce, and map the Account ID  field to the corresponding column. Leave the Account-related fields unmapped. Click the “Next” button at top right. 
  10. In the final step of the import process, click “Import”, and then “Done”. 
  11. We’re done. If you now navigate to the “All Accounts” menu item under the Accounts tab, you will see the three new account records, and the corresponding contact records in the child tab. 

Example: De-duplicating across Leads and Contacts #

As another example use case, suppose you have a CSV data set that you wish to import as lead records into your Lead object, but you want to ensure that the imported leads are not already in your Contacts object. Suppose further that your criterion for a lead to already be a contact is that there is a record in the Contact object with the same first name, last name and email address. You can then proceed as follows.

  1. Use your CSV data as input to a Contact import, as follows:
    • Choose “Import new records” as the operation, and “Update existing” as the duplicate handling action.
    • In Step 2 of the import wizard, select “Omit erroneous records” as the choice for “On data errors.”
    • In Step 3, instead of finishing the import, simply download the match results.
  2. This download now gives you a CSV file containing a record ID column, and each record that is already in your Contacts list will have a matching contact ID in that column. You can now use Excel (or other spreadsheet program) to sort that CSV file on this column and remove all rows that include a value in that column.
  3. Finally, import the result of this removal into your Lead object in the usual way.

Powered by BetterDocs