I've set up lookup and master-detail relationships between objects in Salesforce, and I have SQL-exported CSVs of legacy data which mirror these relationships. How do I preserve the existing relationships in the old data when I import into Salesforce? My ID fields are all autonumber, and it seem that I can't import my own IDs (even if they are in the same A-{0000} format).


First you can't import primay Ids in Salesforce. They are always automatically generated on insert.

For the relation you need to export the freshly imported master objects back again and in the detail table you have to replace your custom ids by the new salesforce ids. E.g. Excel can do that with VLOOKUP(). But it's not funny...

Option 1

You can use workbench to do it easier https://developer.salesforce.com/page/Workbench

Workbench is similar to dataloader, also free and in my opinion way smarter.

It has a feature called smart lookups which does what you need. Read the documentation on how to use it.

Option 2

If you need to do imports like this not only once, you can have a look a ETL tools like TalenD, which I personally prefer.

Search for TalenD here or read this to get an impression http://www.codeulike.com/2014/02/copying-data-to-salesforce-sandboxes.html?m=1

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.