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
samch_uncsamch_unc 

Apex Data Loader and External ID problem

I am using Apex Data Loader 18 to import records into a custom object I created.  My SDL field mapping file has a line that looks like this:

 

Attorney_Firm_Key=Account\:External_Key__c

 

 

My CSV import is structured correctly, the External_Key__c field exists in the Account object, and it is appropriately marked as an external identifier.

 

I know this general import method can work, as I have successfully imported our company contacts from an external system and linked them to their related accounts with the same "Account\:External_Key__c" value.

 

My problem is that running the import for my custom object fails with the following message:

"Invalid property name 'Account:External_Key__c'"

 

When I look at my Enterprise WSDL, the Account object has External_Key__c listed.

 

Again, I am confused that this would work for importing Contacts but not for importing custom objects.

 

I was able to temporarily work around this issue by using Import Custom Objects under Data Management in our SFDC org.

 

I'd like to know what's going on and how to fix it so that I can setup automated nightly imports using the Data Loader.  Any help would be appreciated.
Best Answer chosen by Admin (Salesforce Developers) 
samch_uncsamch_unc

Nevermind!  I figured it out.  I had renamed the lookup field, so I should've have used:

Attorney_Firm__r\:External_Key__c

 

That does the trick!

All Answers

VinnySusanthVinnySusanth

Hi Samch,

 

What i understand from your post is that: you have a CSV file from which you want to import the data to a custom object through data loader.

 

Since you are importing the data to a custom object,the Account external Id will not have any role.(The field  External_Key__c is an external id on Account object).If you need to link your custom object records to Account object,there should be one more column in your csv which contains the Account Ids of the related accounts.

This column(which contains the AccountId) can be mapped to the Attorney_Firm_key field of your custom object from the data loader.

 

Hope this helps.

 

samch_uncsamch_unc

Hi VinnySusanth,

 

So, the Account external id by iteself is not sufficient for a custom object import?  Why does it work for importing Contacts?  I think I'm missing something here.  If I had the Account IDs in my external system, I wouldn't need the external ID field in the Account opbject.  How would I be able to easily add the Account IDs into my CSV?

 

Thanks

VinnySusanthVinnySusanth

Hi Samch,

 

Download the externalId and the AccountId from salsforce for the Account object.(through dataloader export).

Now do a v-lookup between this downloaded csv and the Original csv file so that the accountId corresponding to an externalId can be mapped to your csv.

samch_uncsamch_unc

Hi VinnySusanth,

 

I know that I could do this manually in Excel if I wanted to, but the Data Loader should recognize the external ID and process this for me, right?  Again, this worked with Contacts and Accounts.  I guess I'm looking for an explanation about why this isn't working for a custom object.

 

Any help would be appreciated.

-Sam

samch_uncsamch_unc

Nevermind!  I figured it out.  I had renamed the lookup field, so I should've have used:

Attorney_Firm__r\:External_Key__c

 

That does the trick!

This was selected as the best answer
ErikTheTinkererErikTheTinkerer

I have added some detailed steps to the DataLoader documentation on doing upserts using external IDs.

 

Daves question'sDaves question's

HI, i wanna know how to use apex down loader and wt r the rules to write csv files