S2S Data Migration

Things to Set up for S2S migration:

a) First of all we need to enable Salesforce to Salesforce connection in both the source and target organisations.

b) Then we need to enable the Connection tab.

c) In the connections tab we need to create a new connection by selecting an account and contact from the lookup in the source organisation.

d) After that a link will be sent to the contact’s email by clicking which, we open the target organisation and create the connection between the source and target.

e) Now that all the connections are ready we can start sharing the objects and fields the datas of which we need to transfer.

f) First we need to Publish the objects in the source organisation by checking them in the list.

g) In the target organisation we need to go the Subscribe/Unsubscribe section and need to accept the objects which are shared by the source organisation and we can check the auto-accept checkbox which implies that data will be auto-accepted after those will be shared by the source organisation.

h) Then in the source organisation we need to check the fields of the objects which we want to share so that those can be visible in the target.

i) Then we can map the fields shared by source organisation with those in the target organisation.

Data Transfer with Lookups:

We can transfer data between two organisations in two modes:

a) Manually – We can see a button in the list view of all objects “Forward to Connections”. We can click this button by checking the datas we need to transfer from the list and then select the connection name to which the data needs to be transferred. We can observe that there are checkboxes present below regarding transfer of the related datas. If we select those the related lookup object datas will be transferred as well. In this way we can transfer related datas as well.

For e.g When transferring accounts, there will be a checkbox below mentioning “Send Related Contacts”. By checking that the related contacts will also be transferred along with the accounts.

#Note: Manual S2S data transfer is best when the data amount is not huge.

b) Apex Script – When there is large amount of data, then data transfer through script will be the best option. What we can do is to create a batch Apex and transfer the data mentioning the batch size and by selecting the connection name through query. We can set the lookups through script as well.

For e.g When transferring accounts we can mention in script to transfer the related datas as well i.e contact, case etc by

acc.relatedList(Contact,Case);

We can also make lookp up through script.

Suppose account is already transferred to target organisation. Now while transferring contacts we can make lookup with parent account by

String accountId = con.AccountId;

con.parentRecordId(accountId);

But remember this parent record lookup assignment are helpful when there is only one lookup present. But when an object has many lookups then we have to send the oldprimarykey and oldparentid through formula field to the target organisation and then in target organisation we have to write script to assign them.

150 150 Burnignorance | Where Minds Meet And Sparks Fly!