When we want to share information from one Salesforce org to another Salesforce org or getting records from another Salesforce Organization can be done in different methods, one of the method is Salesforce to Salesforce connection feature.
Salesforce to Salesforce:
Enable Salesforce to Slaesforce feature
Click on Setup --> Build --> Customize --> Salesforce to Salesforce --> Settings
In the edit, click on enable and save.
Once it is enabled, we can't disable this setting, but we can control the information we want to share with the connections we make. We can stop sharing or modify sharing settings at any time.
After enabling, we get the information like email address, name, template names, etc. Whenever a connection is made first, we have to send invitation to another Organization, they receive the invitation from the email address, name and templates mentioned above.
We can change those address and template fields based on our requirement.
We have to check whether the salesforce to Salesforce connection has appropriate permissions like enabling manage connection permission on the profile of user.
Setting up a Connection:
Make sure to enable Salesforce to Salesforce in both sending and receiving Organizations. Now, we have to establish a relationship between the two organizations.
Let us consider two Organizations org1 and org2. org1 is going to share records with org2, so the sender will be org1 and receiver will be org2.
Create an account and contact with an email address for org2 which will be receiving records, the contact will be used when invitation is sent.
In org1, connection's tab(if not appeared click on add in the tabs and add connection tab) click on new connection. Select a contact under the account which represents org2, click on save and send invitation. The invitation will be sent to the given mail address for the contact.
Org2 will receive invitation email with URL, upon clicking on that email it will redirect to org2 salesforce application. In the connection's tab, it will show connection detail like accept, decline and decide later. Upon accepting then the connection between two organizations is established.
Once the connection is established, next we can transfer records by publishing and subscribing objects.
In org1 click on publish in connection's tab and select the required objects to share, to select fields click on edit and select the fields of the object you want to share.
When objects and fields are published in org1, the receiving side(org2) doesn't receive automatically the data which is published. Org2 should click on subscribe then the published content appears.
Select the objects which you want to subscribe. There will be an option Auto-accept, if it is selected, then the records form publishing org are automatically accepted.
Map the required fields from the sending org1 to the fields available in receiving org2.
There are some considerations to field mapping like, only the same data type fields can be mapped.