We are migrating records from one org to another org and I ran into this scenario.


  1. We have two objects with master detail relation between them and API names are Master__c and Detail__c
  2. On each object, we have External Id column named External_Id__c to make the data migration easier when moving between environments.
  3. Here is the simple schema of the data.

    enter image description here

  4. We have two records in Master__c object and 4 records(two records corresponding to each record in master) in Detail__c object.

Data migration:

  1. It is straight forward that first we should move Master__c records and then Detail__c records.

  2. First, I loaded Master__c records by selecting Upsert Operation in Dataloader and selecting column External_Id__c as external Id and it went fine.


Can I migrate Detail__c records using Upsert operation given that Detail__c.External_Id__c values are not unique?

I was told by the person who designed that he chose to populate the Detail__c.External_Id__c field to match with its parent record MasterId__r.External_Id__c and mentioned that there are some tools to handle this kind of data when moving between environments. Can someone explain me on how to do this?

Note: I am not looking for crazy vlookup operation.

  • if I recall, in Data Loader, you choose which column in the CSV corresponds to the field representing the master; the External_ID__c column in Detail__c should be unique ids for the detail records in case they are the target of some other sobject's lookup
    – cropredy
    Commented Dec 6, 2017 at 1:54
  • @cropredy I was able to resolve parent object relation by mapping Master__r.External_Id__c. The only thing is there are duplicates for Detail__c.External_Id__c and it is causing issues with Upsert operation in Dataloader. I am not sure if this data setup is even correct for upsert operation. I could not get hold of the person who designed this also I am not sure if this setup is correct. wanted to check with experts here.
    – javanoob
    Commented Dec 6, 2017 at 14:37

1 Answer 1


The issue you are having is the CSV for the Detail__c

You have two columns

  • External_ID__c : This needs to be either null or unique for each detail record
  • Master__r.External_Id__c : This should be the external ID of records in Master__c. You will use Data Loader to associate this column to the Master__c.External_Id__c field

When migrating, if Detail__c is never the parent of any other object being migrated, then Detail__c.External_ID__c can be null. But if it will be the parent of some other object, say Foo__c that has a lookup to Detail__c, then these Detail__c will need to have unique External_ID__c

Alternatively, if Detail__c is never the parent of any other object being migrated, just don;t bother to map that column in the Data Loader

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .