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
du-scodouglasdu-scodouglas 

Upsert Data Loader

Hi all,

 

I am looking for some references on how to use epsert with external IDs in the apex data loader...

 

I have a .csv of Accounts and Contacts that I have exported from one SF instance, and I want to correctly upsert it into a new instance... can this be done without VLOOKUP in excel? can upsert do what I want it to?

 

Eventually I would like to understand exactly the process of how this is done, so I can just define a couple beans in the process-conf.xml and do this through the CLI with good portability.

 

Thanks ahead,

Scott

Best Answer chosen by Admin (Salesforce Developers) 
Ritesh AswaneyRitesh Aswaney

For starters, the field you want to match against needs to be marked as an ExternalId on salesforce. Lets take a Contact - Account Example.

 

You'll have to create a field on the Account and Contact called, say, Legacy_Account_Id__c. On the Account, this field must be marked as an ExternalId.

 

You can create a mapping file via DataLoader. If you choose the Upsert operation, the second screen that comes up allows you to join up to related objects. For the Account choose the Legacy_Account_Id__c field as an external Id to match on. If you then click on create a map, it will bring up a grid, where you can map columns in your csv file to salesforce fields.

You then drag Account:Legacy_Account_Id__c to your LegacyAccountId columns in your csv file.

 

When you save the mapping, it is represented as

LegacyAccountId=Account\:Legacy_Account_Id__c

 

which is to say that, match to an account, which has a value in the Legacy_Account_Id__c field, which matches the value in the LegacyAccountId column in your csv file.

 

This is slightly longwinded to explain, as you can probably gather !

 

Also look at this

http://wiki.developerforce.com/index.php/Using_Data_Loader_from_the_command_line

 

 

All Answers

Ritesh AswaneyRitesh Aswaney

For starters, the field you want to match against needs to be marked as an ExternalId on salesforce. Lets take a Contact - Account Example.

 

You'll have to create a field on the Account and Contact called, say, Legacy_Account_Id__c. On the Account, this field must be marked as an ExternalId.

 

You can create a mapping file via DataLoader. If you choose the Upsert operation, the second screen that comes up allows you to join up to related objects. For the Account choose the Legacy_Account_Id__c field as an external Id to match on. If you then click on create a map, it will bring up a grid, where you can map columns in your csv file to salesforce fields.

You then drag Account:Legacy_Account_Id__c to your LegacyAccountId columns in your csv file.

 

When you save the mapping, it is represented as

LegacyAccountId=Account\:Legacy_Account_Id__c

 

which is to say that, match to an account, which has a value in the Legacy_Account_Id__c field, which matches the value in the LegacyAccountId column in your csv file.

 

This is slightly longwinded to explain, as you can probably gather !

 

Also look at this

http://wiki.developerforce.com/index.php/Using_Data_Loader_from_the_command_line

 

 

This was selected as the best answer
zUserzUser

Hello,

I have a question along these same lines that I'm stuck on and hope you can help me with.  I've imported about 2 thousand leads from a purchased lead list already, and have sent that list to a vendor to make mailers to send out.  

The list as it sits external does not have any salesforce IDs or External IDs on it.  I want to take that list as a CSV file and do an Upsert to update the leads currently in salesforce to update a custom field indicating what mailing campaign these leads are a member of based on phone number.  Is it possible to tell the uploader to use the phone number when doing the Upsert operations?

Thank you!