Wednesday, August 20, 2014

How to use Salesforce to Salesforce

Salesforce to Salesforce or commonly known as S2S is a data migration feature that is provided as OOB by Salesforce.com. When there is a requirement for data to be moved from one Salesforce Org to another then without using any third party tools as CastIron or Sap BODS we can move data. The idea is to provide a near runtime integration between org. Some points to consider when implementing S2S:


  •  You cannot publish fields that you do not have permission to edit.
  • Only some of the standers objects and all custom objects are permitted to send data.
Follow these steps to enable and configure S2S:

  1. Go to App Setup > Customize > Salesforce to Salesforce > Settings and click enable.
  2. Go to Connection tab and click "New", before doing anything create a new contact with the email Id of the admin to which you need to connect and provide that contect here.
  3. Once the person receive the invite mail and approve the invite the "Connection Status"will be "Active".
  4. Now click on publish button and choose the objects that you want the data from to be sent click save.
  5. Now go to the edit link beside the selected objects and choose the fields from which the data needs to be sent.
  6. You are all done now go to the reciver org or ask Admin to subscribe the objects and fields in that org.
  7. Now if you go to the published objects tab and open a record in my case Account edit the layout and add the external sharing related list click save. 
  8. Now you will see a button named "Forward this Account" click it, choose the connection name and Save, you data will be send to the receiver org.
We can do this by Apex code also use the "PartnerNetworkRecordConnection" object and insert the record with connection Id that we setup above and record Id:


1PartnerNetworkRecordConnection newConnection =
2                    new PartnerNetworkRecordConnection(
3                        ConnectionId = networkId,
4                        LocalRecordId = newContact.Id,
5                        SendClosedTasks = false,
6                        SendOpenTasks = false,
7                        SendEmails = false,
8                        ParentRecordId = newContact.AccountId);
9insert newConnection;

Hope this helps you!!

No comments:

Post a Comment