Author: Rishabh Dubey
We have many accounts and contacts that we have exported from our previous CRM or salesforce Org. Now we want to import all that data into the new Salesforce org with the relationship intact. We can use the Upsert function in Data Loader to do the same.
“Upsert” is a combination of inserting and updating – if a record in your file matches an existing record, the existing record is updated with the values in your file, and if not, a new record is created as per the values in your file. Also, we will require an external Id field to operate.
Prerequisites- Export from Accounts and Contacts from previous org or CRM. The files should have the below columns.
Account File – Account ID, Account Name, and all other required fields.
Contact File – First Name, Last Name, Account ID, Contact ID, and all other required fields.
Step 1: We will need to create an External ID field on Account to store the Account Ids from our Previous CRM.
- Go to set up.>Object Manager>Accounts> Fields and relationship>New
- Select text as Data Type of your FIeld.
- Give Field label and length also check Unique and External ID checkbox. Under Unique, select “Treat “ABC” and “abc” as different values (case sensitive)” radio button.
- Set Field label security for the field and do not add the field of the Page layout.
Step 2: Use data loader to Import Accounts Using CSV file.
- Login to the new salesforce org using data loader
- Click Insert, Select Account object to perform the insert operation, and select the file for the operation
- In the field mapping map, the Account name with Name and the Account Id from the previous
Org to the external Id field we created. Click next and then finish.
Step 3: Upsert Contact object to create new contacts and attach the contacts with the correct Account.
- Open Data Loader. Click on upsert.
- Select contact Object and your file
- For “Select the field for matching on contact,” select ID.
- For Account, select the External ID field.
- Mapping Should be.
First Name: First Name
Last Name: Last Name
Account ID: External ID field that we have created.
- Click next and then finish.