Synchronize data from Salesforce to external system

 

In this tutorial we will see how can we Synchronize data from Salesforce To External system

There are multiple options provided to sync the data between Salesforce and external system

 

Platform events

Use platform events to connect business processes in Salesforce and external sources through the exchange of real-time event data.

With platform events, you can publish any custom data. You define the schema of event data at a granular level as typed fields. Also, you can use platform events in native Salesforce platform apps and external apps alike.

Platform events are part of Salesforce’s enterprise messaging platform. The platform provides an event-driven messaging architecture to enable apps to communicate inside and outside of Salesforce

Note: Salesforce stores platform events for 24 hours or you can retrieve all stored events, or you can specify the replay ID of an event to get all the events generated after the replay ID

Even though Salesforce retains event records temporarily, you can’t query them through SOQL. Similarly, you can’t use event records in the user interface in reports, list views, and search

 

When to use platform events:

There are multiple scenarios where we can use the platform events

In the first scenario, an app in Salesforce notifies external order fulfillment apps of a product shipment order: In this scenario when a customer orders a product, a order is created in Salesforce and a platform event is generated and the external app which is vendor app to ship the product subscribe to the platform events message and create the shipment order

In the second scenario, an external product app notifies Salesforce of merchandise returns:

The external system publishes a platform event to alert Salesforce to the merchandise return. An event listener (a trigger) in Salesforce receives the event and performs some actions. For example, the trigger might alert the sales representative to the return, and send a confirmation email to the customer

The last scenario shows how event messages are used within Salesforce by using triggers: In this scenario, you can perform the same actions using other Salesforce features, such as Process Builder or flows

You can publish custom platform events on the Lightning Platform by using Apex or point-and-click tools, such as Process Builder and Flow Builder, or an API in external apps. Similarly, you can subscribe to an event channel either on the platform through an Apex trigger or point-and-click tools, or in external apps using the CometD-based Streaming API

Please visit platform event working sample post to see how can we set up the platform events in Salesforce and publish and subscribe the events

Ref: https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/

 

Change Data Capture

Change Data Capture is a streaming product on the Lightning Platform that enables you to efficiently integrate your Salesforce data with external systems. With Change Data Capture, you can receive changes of Salesforce records in real time and synchronize corresponding records in an external data store. Change Data Capture publishes events for changes in Salesforce records corresponding to create, update, delete, and undelete operations

Use Change Data Capture to update data in an external system instead of doing periodic exports or API polling. Capturing changes with Change Data Capture event notifications ensures that your external data can be updated in real time and stays fresh

Using the publisher/subscriber model and push technology, Change Data Capture sends notifications to subscribers whenever a data change in Salesforce occurs. Notification messages are sent to the event bus to which clients can subscribe through a channel

Note: Event can be retained for up to 3 days.

When to use change data capture:

When you have an enterprise resource planning (ERP) system that stores your business information, and some of your data in Salesforce is duplicated there. To ensure that your ERP data is up to date, you can use change events to synchronize changes to the Salesforce records in your ERP system.

 

Synchronize data from Salesforce To External system

 

Push Topic Events

Push topic events are part of streaming api, by using push topic events we can capture the changes in Salesforce record on the basis of the predefined SOQL query

To work with push topic events you need to follow the below steps:

Create topic in Salesforce and configure with SOQL query

Now you can subscribe the topic by using SubscribeTopic or ReplayTopic operations available in Salesforce connector

Note:Push topic events also retained the data for 24 hours and you can replay the data on the basis of the replay id

When to use the Push Topic Events:

  • Receive notifications of Salesforce record changes, including create, update, delete, and undelete operations.
  • Capture changes for the fields and records that match a SOQL query.
  • Receive change notifications for only the records a user has access to based on sharing rules.
  • Limit the stream of events to only those events that match a subscription filter.

 

Generic Events

Use generic events to send custom notifications that are not tied to Salesforce data changes.

Use generic streaming when you want to send and receive custom notifications.

When to use generic events:

  • Publish and receive arbitrary payloads in JSON without a predefined event schema
  • Broadcast notifications to a target set of users, specific teams, or your entire org
  • Send notifications for events that are external to Salesforce

To work with generic events we need to configure the streaming channel 

Please visit this url to see how can we publish and subscribe the events from channel using salesforce connector operations

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments