function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghu Sharma 6Raghu Sharma 6 

loading data with data loader for parent child relationships using external id

I need to import Accounts and Contacts from external system. I have defined external ids on both contact and accounts. I have to load accounts with external id first and then load each contact with external id of account with which it needs to establish relationship. Is this how it works? It did not work for me. Please help.

Eg: I have loaded account 'Oil Corporation' with external id as 'AAAA' 
After account is successfully loaded, I have loaded two contacts 'PersonA' and 'PersonB' with exteral id as 'AAAA' and they got successfully loaded but are not connected to account. I did specify that the relationship to be used on exernal id 
Best Answer chosen by Raghu Sharma 6
BalajiRanganathanBalajiRanganathan

Disregard my previous answer, and follow the steps as given in the below url

http://blog.ryansieve.com/2013/03/14/using-salesforce-com-data-loader-upsert-with-an-external-id/

All Answers

Raghu Sharma 6Raghu Sharma 6
Thanks Balaji for your reply.......While bringing huge data from other system, how can we maintain the same contacts connected to see accounts? How will I map contacts onto accounts? So, external id is useful only to handle single object in data loader...no relationships can be handled thru external id?
BalajiRanganathanBalajiRanganathan

Disregard my previous answer, and follow the steps as given in the below url

http://blog.ryansieve.com/2013/03/14/using-salesforce-com-data-loader-upsert-with-an-external-id/
This was selected as the best answer
Raghu Sharma 6Raghu Sharma 6
finally understood...but looks like even though it is not mandatory to have external field on contact, we still need a field on contact which can be mapped to account.externalid
BalajiRanganathanBalajiRanganathan
While loading contact, you have to follow the upsert wizard ( and do the steps 7, 8 and 9 in the below url
http://blog.ryansieve.com/2013/03/14/using-salesforce-com-data-loader-upsert-with-an-external-id/

my explanation at high leval
step 7) select default id to match with existing contact. ( it will not match any as you will not have id column in your import for contact)
step 8) select external id on the account ( this step is important and which does the lookup of account for the given contact)
step 9) map the external id column in your import file to account.<extenal_id__c)
BalajiRanganathanBalajiRanganathan

I think we dont need to have the extenal id in the contact. we are just mapping the extenal column from import file to parent external id (step 9)
Raghu Sharma 6Raghu Sharma 6
got it! Thank You Balaji