How to Import Contacts for Existing Accounts

In this tutorial, we will show how to import a file with Contacts data for existing Salesforce Accounts. When preparing such a file, you need to somehow specify accounts, for which you insert these contacts. It’s not an easy task to specify accounts in this file by their Salesforce Account IDs — 15- or 18-character strings. In such cases usually account names or some other numeric IDs are used. But when importing this file to Salesforce, you need to assign values to the foreign key AccountID field. Skyvia offers two ways to solve this problem — external IDs or lookup.

Creating Connection

Regardless of the way you want to specify parent accounts for contacts, first you need to create a connection to the target Salesforce if you haven’t created it yet. To create a connection to Salesforce, perform the following steps:

  1. Click +NEW in the top menu.
  2. Click the Connection button in the menu on the left.
  3. In the opened Select Connector page, select Salesforce. To quickly find it, you can either use the Type to filter box or filter connectors by categories using the All list (for Salesforce, select the CRM category).
  4. The default name of a new connection is Untitled. Just click it to rename the connection, for example, to Salesforce1.
  5. From the Environment drop-down list, select the Salesforce environment type to import data to. Since this is just a sample walkthrough, the Sandbox environment is recommended.
  6. From the Authentication drop-down list, select the authentication method for connecting to Salesforce. If you don’t mind storing your Salesforce credentials on our Skyvia server, select User Name & Password. If you prefer not to store your credentials, select OAuth 2.0.

    Connection Editor window

  7. If you have selected User Name & Password, on the previous step, specify your Salesforce account e-mail, password, and security token. Otherwise, if you have selected OAuth 2.0 authentication, click the Log In with Salesforce button and login via the Salesforce website on the opened page. The result OAuth token will be stored in the connection data. Your Salesforce credentials will not be stored on our website.

    Log In window

  8. Click Create Connection.

    Connection Editor window 2

Importing Contacts Using External IDs

External IDs can be used for importing if the Account Salesforce object has a custom external ID field. External ID fields are the fields that uniquely identify records. If your Account object has such an external ID custom field, and your CSV file with Contacts contain a column, identifying the parent accounts, use the following steps to import the contacts file:

  1. Click +NEW in the top menu.
  2. In the Integration column, click Import. The import package details page will open.
  3. Rename your package by clicking and editing the package name. The default package name is Untitled. Please note, if you omit this step, the package name will remain Untitled in the list of created packages.
  4. Under Target, in the Connection list, click Select target and select Salesforce connection from the drop-down list. You can use the Type to filter box to quickly find the necessary connection.

    Target Connection window

  5. Click the Add new link to open the Task Editor.
  6. Drag your file to the drop here your file area or click the browse link and upload the CSV file with Contacts data to import.

    Source CSV

  7. Specify the CSV options if necessary.

    CSV Options

  8. Click the Next step button in the bottom of the dialog box to switch to the next editor page. You can also switch between the editor pages by clicking the corresponding icons: Source Definition, Target Definition, and Mapping Definition.
  9. In the Target list, select Contact.

    Target List

  10. Click the Next step button in the bottom of the dialog box to switch to the next editor page or click the Previous step button to return to the previous page.
  11. Click the AccountId field.
  12. Click Column and then click External ID on the drop-down list.
  13. In the Source Column drop-down list, select the CSV file column, containing external id values, determining parent accounts.
  14. In the External ID Column drop-down list, select the Account external ID field name.

    External ID Column

  15. If the names of columns in the CSV file are not the same as Contact field name, map other unmapped fields to the source file columns.
  16. Click the Save button to save the task.
  17. Click the Create button to create the package.

Now your package is ready, and you can run it to import your contacts.

Importing Contacts Using Lookup

By default, Account object does not have external ID fields. If you don’t want to modify the Account object and add a custom external ID field to it, you can use lookup and identify parent accounts by their names. To import a CSV file of Contacts with the column containing parent account names, perform the following steps:

  1. Click +NEW in the top menu.
  2. In the Integration column, click Import. The import package details page will open.
  3. Rename your package by clicking and editing the package name. The default package name is Untitled. Please note, if you omit this step, the package name will remain Untitled in the list of created packages.
  4. Under Target, in the Connection list, click Select target and select Salesforce connection from the drop-down list.

    Target Connection

  5. Click the Add new link to open the Task Editor.
  6. Drag your file to the drop here your file area or click the browse link and upload the CSV file with Contacts data to import.

    Source CSV

  7. Specify the CSV options if necessary.

    CSV Options

  8. Click the Next step button in the bottom of the dialog box.
  9. In the Target list, select Contact.

    Target List

  10. Click the Next step button in the bottom of the dialog box.
  11. Click the AccountId field.
  12. Click Column and then click Target Lookup in the drop-down list.
  13. In the Lookup Object drop-down list, select Account.
  14. In the Result Column drop-down list, select the ID.
  15. In the Lookup Key Column drop-down list, select the column from the Account table.
  16. In the drop-down list under Column, select Company name from CSV file.

    Target Lookup

  17. If the names of columns in the CSV file are not the same as Contact field name, map other unmapped fields to the source file columns manually.
  18. Click the Save button to save the task.
  19. Click the Create button to create the package.

Now your package is ready, and you can run it to import your contacts.