Our client needs to import Contact information from a partner org via Salesforce to Salesforce. They also need to import CustomObject__c records, that have a lookup field to Contacts (that is: a Contact has n CustomObject__c).

How can I achieve that, after importing Contact A (which creates a copy on my org), CustomObjects that I import that belong to Contact A in the partner org will be associated to that same Contact A in my org?

有帮助吗?

解决方案

Assuming the data migration isn't just a one-time activity, you're going to want to create a formula field on your Contact object that will hold the original ID of the record. Then, you can map this value over to a text field on the destination org's Contact object. A bit of code in a trigger on your CustomObject__c object should then be able to query the correct Contact record based on the old ID, and then update the lookup field accordingly.

For code samples, check out the "Reestablishing Lookup Relationships" section of the Best Practices for Salesforce to Salesforce guide.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top