What is the best way to redo a data migration? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Elite Secure AdminElite Secure Admin 

What is the best way to redo a data migration?

I need to complete redo the way the data is arranged in our Entrprise Salesforce.com instance.

Here is what we plan to do.

Download the data from Leads, Accounts, Opportunities, and Contacts
Wipe all the data in these objects
Remap the data fields to Leads, Accounts, Opportunites, and Contacts and to some new Custom Objects
Import the data into these objects

What is the best way to accomplish this?
Anyone have experience doing this and what would you charge for a project like this?


Sandeep MahalSandeep Mahal
Hello Michael, 

If you need to delete all the data from your enterprise SFDC instance and load everything again, it will not create any issues while deleting and migrating the data again. Keeping backup of all the deleted data should be considered.

But if you need to delete only last set of data, which is migrated in the last cycle of data migration, the process becomes pretty difficult. In this case, you need to find out the data entered in the last data migration cycle using 'last modified by' field and probably 'owner'.
Matthew LambMatthew Lamb
If you're on EE the Apex Data Loader is the best tool to accomplish what you're looking for.


One thing to be mindful of is maintaining the relationships among objects. Right now your Contacts are related to Accounts, and Opportunities related to Accounts and Contacts. Those relationships are driven by the Id values of those records. This gets a bit more complicated because when you delete and re-insert a record, the Id value is generated anew.

My recommendation is to create temporary fields for each record Id to support your re-import, and each one will hold the Id of the record as it exists today in your org. So on Account you'd have a field called Previous Account Id. When creating this field, make sure to mark it as an External Id (very important!). This will allow you to, instead of inserting, use the Data Loader upsert command, which allows for matching against an External Id. This will make the importing of child objects much simpler when trying to get them assigned to the right parent. You'll have the AccountId on the Contact in your export, and now that you've got the old Account Id of each Account stored in the Previous Account id field, you can upsert against that field when upserting your Contacts.

Also, I would highly recommend, before you actually wipe anything, trying to migration into a sandbox to make sure you're got your process down.
Elite Secure AdminElite Secure Admin

For the External ID, what type of field type do you recommend?
Autonumber?  Trying to figure out how to extend the External ID, I created for Accounts, to carry over to Contacts, Opportunities, etc

Matthew LambMatthew Lamb
Hi Scott - An auto-number can't be set to an External Id (I don't think...). But regardless, an auto-number will actually automatically fill itself in each time you create a new record, and you can't load data into it, so that's a no go.

I would use a text field (since you're storing Salesforce Record Ids, which are alpha-numeric) and make that text field your External Id.

And you actually want one External Id per object. Your goal is to, for each record, store that record's Id in your current system. So each Account record has it's own External Id value (i.e. that Account's Record Id in your current system), and each Contact, Opportunity, Lead, etc will have it's own unique External Id value (again, that record's Salesforce Record Id in the current system).
Natalia MyachinaNatalia Myachina
Michael, my company Import2.com could help you, but we need to know more details about your data structure. Can you send us an email to sales@import2.com so that we could get in touch with you?
Anastasiia DyshkantAnastasiia Dyshkant

To redo a data migration, I suggest using Trujay’s Self-Service Migration tool (https://trujay.com/migrate-to-salesforce/?utm_source=migration-to salesforce&utm_medium=comment&utm_campaign=salesforce-community). You can try before you buy with our free sample migration which lets you test out the system. You can run this free sample as many times as you need at no cost. If you need help using the Self-Service tool, contact sales@trujay.com to get a Guided Service. If you have any other questions or are looking for a custom project, contact us (https://trujay.com/contact-us/?utm_source=contact-us&utm_medium=comment&utm_campaign=salesforce-community)!