+ Start a Discussion
boBNunnyboBNunny 

Using External ID for Upsert

I'd like to know how DataLoader 10 sets a field for Upsert based on External ID.  What attribute of the Contact sObject does it set?  Also, it asks for 2 records for foreign key External ID Upsert (Account and Reports To).  What does it actual DO with the field selected in order to tell SalesForce to use it and why doesn't that apply to other foreign keys (i.e. Owner).
 
Thanx!
benjasikbenjasik
there are two types of upsert.  upsert on the primar object (sounds like in your case contact).  If you have multiple externalIds, the data loader should let you choose which one is used.

the second type of upsert is upsert with relationships.  This allows you to associate a contact with a related record, based on that related record's externalid.  Say you wanted to associate a contact to an account.  If the account has an externalid, you can use the account externalid, and not have to use the salesforce.com accountid.  Owner would only be an option if you have an externalid on the User record.
JasonLincolnJasonLincoln
Can the upsert with relationships be used with Data Loader's command line?  If so, are there any examples of an SOQL statement that will do this?  I am attempting to pull Customer data from Oracle R12 and migrate this to SF but need to also include location and owner (account manager) data.  One is a reference from Account and the other is a reference to Account (child).  I can pull the data from Oracle using DataLoader's command line and upsert SF but I don't know how to get the owner id (unknown in Oracle) or the location id (also unknown in Oracle).  This is a one way interface.
bytor1971bytor1971
I was able to figure out how to perform the upsert with relationships using the Data Loader command line utility.
kamisaabkamisaab

Hey bytor1971,

 

Would you mind sharing how did you do that.

 

Thanks

Kamran

boBNunnyboBNunny

Getting DataLoader via command line to use the foreign keys is easy.  Just make the column header the reference field instead. 

 

i.e. Account__r\:Vantive_Customer_ID__c

 

I'm more interested in how they did it code-wise so that we can create our own applications similarly.