Background

One of our clients manages two Salesforce instances within their organization to provide assistance to clients. These instances serve different business purposes and are used for program management by different departments that employ different data models. Recently there has been a need to serve clients across the two divisions and therefore a need to share some limited data about specific clients across the two databases.

Our client reached out to DaizyLogik to craft a solution that would allow the organization to securely transmit data across the two Salesforce databases bi-directionally, without getting locked into an expensive third party ETL tool with recurring and increasing licensing cost. Even though third party ETLs can be a good way to connect two Salesforce instances, these tools come with a licensing cost that keeps increasing over time, are usually difficult to configure to handle complex scenarios, and can be hard to maintain because they cannot be placed under source control. In addition to 3rd party ETLs, other options that were explored included setting up a Salesforce to Salesforce connection (which only works in classic, is not real-time and does not support the type of transformations needed because of the different data models) and Salesforce Lightning Connect (which comes with a sharp price tag and does not allow for the complex configuration that was needed).

Solution

DaizyLogik proposed a solution that leverages the concept of External Services which makes it possible to securely access REST Web services from another Salesforce instance via Flows by exposing an API (Application Programming Interface) specification. This solution combines the flexibility of addressing complex integration use cases with ease of use for the Salesforce administrators who can easily build the flows they need to transmit the data via APIs in real-time or in a scheduled fashion.

How Does It Work?

When the Source Salesforce organization needs to send data to the Target Salesforce organization this can be accomplished via a Flow that assembles the payload (data to be transmitted) from the various records in the source organization and then passes the payload to the External Service which is registered in the source organization. The Flow can be designed to be either record triggered or scheduled, providing lots of flexibility to control when data is synchronized.

Flow Assembles the Data

External Service Sends Data

The External Service contains the signatures of the operations or methods available to take the data and send it to the Target Organization.

Target Web Service Receives Data

In the Target Salesforce organization a web service is tasked with receiving the data (in JSON format) from the source, and based on the operation type it processes the data into the target objects and fields performing any matching logic that is needed to ensure that existing data is not duplicated.

1
2
3
4
5
6
7
8
9
{"operation":"process-record",
"items":[{"value":"Jane","fieldName":"FirstName"},`<br>{"value":"Test","fieldName":"LastName"},<br>```{"value":"1989-9-27","fieldName":"DateOfBirth"},
```{"value":"a9x4t000009unccZZZ","fieldName":"ExternalId"},...]}`

Named Credentials

The connection between the Source Salesforce and Target Salesforce is done through a Named Credential which securely connects the two systems. The security of this connection is further improved by using an API Only user with a Salesforce Integration License which can only access the objects and fields that are involved in the integration.

Bi-directional Architecture

By establishing a bi-directional architecture this solution allows for information to be synchronized back from the Target organization to the Source Organization when needed, in a similar fashion.

What are the Benefits?

This solution will require that some Apex code be written in the Target organization(s) to process data and create or update the records being synchronized. Creating the API Specification in the Source organization(s), that exposes the signatures of the operations available to the synchronization, will also require development skills, but there are benefits to this approach that make it worthwhile:

  • No getting locked into a 3rd party application that might get discontinued
  • No licensing costs that increase over time
  • No data being stored off the Salesforce platform or being transferred through another platform
  • No limitations in complexity of the operations performed to transform the data especially when the source and target organizations use different data models.
  • Apex code and flows can be placed under source control
  • This approach can be implemented as a bi-directional synch
  • By using Flows administrators can synchronize data either real-time or on a schedule
  • Allows for logging of each transaction in the target organization, so any issues can be troubleshooted

Want to learn more? Contact DaizyLogik to learn more about how we can support you with specialized consulting and custom development and help you get the most out of Salesforce.