0

When trying to upsert contacts and relate the Contact to Account using an external ID on Account I am getting the following error

Foreign key external ID: ABC12 not found for field DBExt_ID__c in entity Account

I have an Account record in SF (in the correct instance) where the External Field DBExt_ID__c = 'ABC12'

DBExt_ID__c is marked as external id in Object manager:Account

DBExt_ID__c is a text field.

On Contact there is field called DBExt_ID__c which is a lookup to Account. On Contact the external field is called UserExternal_ID__c which is a lookup to Account.

Edit Using Dataloader to do the upsert of Contacts, using ContactsExternalID.

CSV

**ParentAccountExternalID   ChildContactExternalID  FirstName   LastName**

    ABC12                    User123                 Tim         Song
    PQR34                    User345                 Jim         Haas

Mapping

ChildContactExternalID =UserExternal_ID__c 
LAST_NAME=LastName
FRST_NAME=FirstName
ParentAccountExternalID=Account.DBExt_ID__c  

(also tried ParentAccountExternalID=DBExt_ID__r. DBExt_ID__c)

The problem is with mapping the Contact to the Accounts ExternalID so that i will be able to relate the Contact to correct Account via ExternalID.

2
  • How are you trying to do the upsert? Is it via something like dataloader, or are you doing this in Apex? If there's code involved, showing us what you have is helpful.
    – Derek F
    May 7 '20 at 21:24
  • I am doing it via dataloader. Will edit the main quetion. May 7 '20 at 21:37
0

I was able to resolve the error. I changed the Column Headers in the CSV for the External Id fields. Not sure why this resolved the error, but it did.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.