Salesforce, the world’s leading CRM software provider— offers a practical feature in their product to share data (records) with other organizations. Salesforce to Salesforce feature enables Salesforce administrators to sync Salesforce records of two different organizations effortlessly. This is an ideal feature for businesses that rely extensively on data. An ideal scenario is when your primary organization’s Salesforce is experiencing a downtime or going through a scheduled maintenance, Salesforce to Salesforce feature minimizes the impact by providing users the access to a secondary organization’s data. However, there are certain limitations to this feature— once enabled, this feature cannot be disabled. The only way to stop the process is by deactivating the connection.

Getting Started with Salesforce to Salesforce

To activate the Salesforce to Salesforce feature, navigate to Setup -> App setup -> Customize -> Salesforce to Salesforce -> Settings. Click on the Edit button and select Enable option, you will be able to view the Connection Tab and External Sharing Related List option (Add this option to the page layout screen).

The first and foremost activity is to create an account and contact records in the source organization by providing information about the target organization with which the data is going to be shared. Use the connection tab to create a connection between the two organizations by selecting Contact and Account Records. An email would be triggered to the contact person along with a link to establish the Salesforce connection, as soon as the request is accepted, the Salesforce connection is established.

Salesforce To Salesforce Sync


Publish/Unpublish Objects and Fields

The next step is to list the objects and fields that are desired to be shared/synced with the other organization; this process is termed as Publish/Unpublish of objects. Salesforce to Salesforce feature supports both one-way and two-way data sharing. Salesforce data can be shared by following a manual or automated process by utilizing Apex triggers.

Subscribe/Unsubscribe Objects and Fields

To sync data with the target organization, subscribe to the Objects and Fields published in the source organization by using the Edit option available beside the Object Name field. Now, we are all set to sync the data (one-way). A slightly different approach has to be followed for the two-way sync process, here we have to publish and subscribe the objects in both the organizations. All changes and updates made are captured in the Connection History log.


Manual Sync Process

All custom objects and standard objects such as accounts, contacts etc., can share data using the Salesforce to Salesforce feature. Additionally, single record or multiple records can be forwarded to either a single connection or multiple connections. The status of the forwarded record will be shown in the ‘External Sharing’ related list.

Here is the navigation process to access Forward to Connections feature, go to List view for the Object -> Select the Records -> click on Forward to Connections.


Automated Sync Process

By writing Apex triggers, Salesforce records can be shared with the target organizations automatically.

Here is the code to share an account record via Salesforce to Salesforce programmatically.

  • Create an apex class ‘ConnectionHelper’ using the below code:
[java]public class ConnectionHelper {
public static Id getConnectionId(String connectionName) {
List<PartnerNetworkConnection> ConnectionList = [Select id from PartnerNetworkConnection where connectionStatus = 'Accepted' and connectionName = :connectionName];
if ( ConnectionList.size() != 0 ) {
return ConnectionList.get(0).Id;
return null;
public static Id getConnectionOwnerId(String connectionName) {
List<PartnerNetworkConnection> ConnectionList = [Select createdById from PartnerNetworkConnection where connectionStatus = 'Accepted' and connectionName = :connectionName];
if ( ConnectionList.size() != 0 ) {
return ConnectionList.get(0).createdById;
return null;


  • Create a Trigger ‘AccountSyncTrigger’ using the below code:
[java]trigger AccountSyncTrigger on Account (after insert) {
Id networkId = ConnectionHelper.getConnectionId('Connection Name Here');
Set<Id> AccountSet = new Set<Id>();
for (Account acc : {
if (acc.ConnectionReceivedId == null )
if (AccountSet.size() > 0) {
List<PartnerNetworkRecordConnection> accConnections =  new  List<PartnerNetworkRecordConnection>();
for (Account accRec : Trigger.New) {
if (AccountSet.contains( {
PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkId,
LocalRecordId = accRec.Id,
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = false);
if (accConnections.size() > 0 ) {


The Salesforce to Salesforce feature is quite useful for organizations, where users work on business-critical processes and any downtime can impact an organization’s ability to serve their customers. This extremely useful feature allows Salesforce users to connect and share data with other organizations seamlessly. Further, connections can be made either one-way or two-way. Moreover, the records can be shared either manually or through an automated process using Apex triggers.

Evoke’s Salesforce Solutions

Evoke Technologies provides end-to-end Salesforce Solutions to global enterprises. We understand the fact that implementing Salesforce across an enterprise can be a challenging process, if not planned diligently. With our proven experience in the Salesforce implementation and customization, we enable businesses to realize the true potential of Salesforce. We chalk out a clear strategy and provide expert guidance for Salesforce implementation and customization.

Our experienced Salesforce consultants simplify the implementation process even for some of the most complex deployments. Further, with our proven expertise in Salesforce implementation and customization, we enable businesses to truly world-class customer service to their clients. To learn more about our Salesforce solutions, contact us via our website or call us at +1 (937) 202-4161 (select Option 2 for Sales).


  Anoosha Jogu worked as a Technical Associate at Evoke Technologies, she has 4+ years of experience in software development. She is a passionate Salesforce Developer and worked on different projects at Evoke, she is keen to learn new technologies and has a good expertise in Salesforce implementation.
Please follow and share

Leave a comment