+ Start a Discussion
Dhaval PanchalDhaval Panchal 

How to import bulk data with lookup values

I want to import records for two different object (Account and Contact).
My requirement is that once I import contact, AccountId field should be linked with Imported account records.
Any one have idea how to do this?

Best Answer chosen by Admin (Salesforce Developers) 

Here is how you would need to do it using the Apex Data Loader:


Step 1: Prepare your Accounts data in CSV format and import using the Data Loader

Step 2. From the success file, pick up all the Account ID's that you get from the records that are created from the import 

Step 3: In your Contacts file, you should have the Account Name already for each Contact row. You now need to map the Account ID's from your Account success file to this file

Step 4: Add a new column called Account ID to your Contact CSV file

Step 5: Using the excel VLOOKUP function, bring over the Account ID's into your Contact CSV in the Accont ID column

Step 6: Once you have all the Account IDs mapped, you can then remove the Account Name column from your Contact import file. You don't need this anymore as you now have the Account IDs

Step 7: Your Contact file is ready for import (check for the other columns to make sure you have all the required fields to ensure that the import is a success)


Once you import this file, your Contacts will get created and will automatically get associated to the relevant Accounts based upon the Account IDs that you have mapped in the file


Hope this helps! Let me know if you need further inputs.