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
Vidya BhandaryVidya Bhandary 

Migrate master data from one org to another

Hi,

I read that I can use Migration tool to move metadata from one org to another.

I want to move some basic master data required for my application.
How can I do this ?

The objects have master-detail and lookup dependencies between them and hence I am not sure of using the data export functions.

Can I use an apex method instead ?

Thank you


Best Answer chosen by Vidya Bhandary
Andy BoettcherAndy Boettcher
That's pretty much the process!  If I would suggest something - make a new text field in Org 2 on your master data objects called "Migration Id" and import the Org 1 record Id to that field - that will give you the Org 1 Id and Org 2 Id to make the matching process much easier.

Check out this link as well for some more background:  https://developer.salesforce.com/page/Data_Loader_and_relationships (https://developer.salesforce.com/page/Data_Loader_and_relationships" target="_blank)

All Answers

Andy BoettcherAndy Boettcher
There are two kinds of migration here:

1.  Metadata - these are objects, fields, workflows, etc
2.  Data - data records within objects

Metadata - you can create a unmanaged package in your source org that has all components and move it to the new org, or you can use a tool like Eclipse or Mavensmate to deploy metadata from one org to another.

Data - There are a litany of applications out there to help move org data, but most of the time you're looking at exporting everything and importing one object at a time - pulling the Ids back out and mapping master/child and lookups together in Access/SQL or another means.
Vidya BhandaryVidya Bhandary
My data is a subset of the entire data and I don't get what you mean by pulling the Ids back. Are you saying that I should look to placing the data in a SQL server and then importing it in the next org ?
Andy BoettcherAndy Boettcher
In order to import data in a heirarchy - you will have Record Ids of the parent record from the source org on the child records.  When you import those parent records to the target org, those Ids will change...and you need to account for that in the child records.
Vidya BhandaryVidya Bhandary
So does this mean - I have to do the import step by step ? That is what I understand from the reply. If I have 6 objects I need to migrate ..... I could export all data and get the relevant objects csv / xls. After that I need to import say - 2 master objects data directly and then ?

How do I then manipulate the child objects since the IDs will be different ? I am thinking writing apex code but is there any other way ?
Andy BoettcherAndy Boettcher
Apex code isn't going to help you on a data migration.

Step by Step - yes.  You would import the master objects - and then dataloader will spit out a success file with the new Ids from the target system in it.  You can then either use Excel and VLOOKUP the new Ids in or use some SQL wizardry.
Vidya BhandaryVidya Bhandary
I was looking to see if I could automate the entire process - but it does not look like I will be able to do so ! :) 

I see the steps like this ...

1. Export all data form Org 1 [ Cannot choose only the subset as far as I can see ]
2. Consider xls files for data I want
3. Import master data ( may be 2 oibjects ) - Org 2
4. Export master data ( to get new IDs ) - Org 2
5. Manipulate the excel or SQL ( have to check how to do this ... not much exp on DB side ) for child objects
6. And then import into Org2 again ?

Sorry if I am being too detailed. I just thought there must be an easier way !! :)

Andy BoettcherAndy Boettcher
That's pretty much the process!  If I would suggest something - make a new text field in Org 2 on your master data objects called "Migration Id" and import the Org 1 record Id to that field - that will give you the Org 1 Id and Org 2 Id to make the matching process much easier.

Check out this link as well for some more background:  https://developer.salesforce.com/page/Data_Loader_and_relationships (https://developer.salesforce.com/page/Data_Loader_and_relationships" target="_blank)
This was selected as the best answer
Vidya BhandaryVidya Bhandary
Thanks a lot. The link is very useful. It definitely helps ! 
Andy BoettcherAndy Boettcher
You're very welcome!  Good luck!
UC InnovationUC Innovation
Because of all the steps involved in migrating data between Salesforce orgs mentioned here, we've recently developed an app called Cloud Explorer for Salesforce which allows you to drag and drop records between Salesforce orgs just like how you would copy files from one folder to another in Windows:

http://cloudexplorer.ucinnovation.com/

Data Loader was just taking too much time to do for us, with having to download the records in CSV, relate the all parent records correctly between source and target orgs that have different record IDs, and then upload again.  Hope people will find it useful like we have.