Chen Cuello
SEP 28, 2023
icon
5 min read
Don’t miss a thing!
You can unsubscribe anytime

Are you tired of constantly manually updating your Salesforce data? You are not alone. The more we rely on data to make business decisions, the more we need efficient and reliable ways to manage it.

Imagine the following scenario: your sales team is heading out to a major conference; they will be updating your Salesforce data with the latest leads and contacts as they are bringing them in. Once the data is in your CRM, it must be synced with your marketing automation platform and your data warehouse in real-time. Why? Because you have workflows and business processes that need to kick in when certain changes within the Salesforce object happen.

Change Data Capture (CDC)

Simply put, CDC is a tool that allows you to automatically capture any changes made in your Salesforce data and sync it with other systems in real-time. CDC is particularly useful for organizations that rely on multiple systems and need real-time data synchronization. The most common use case is real-time data replication, establishing a continuous synchronization of new and updated data to the external system.

Here are some examples of how CDC can be used in real-life business scenarios:

  • To keep a data warehouse in sync with Salesforce data.
  • To trigger workflows in external systems when changes are made to Salesforce records.
  • To send out notifications to users when changes are made to Salesforce records.
  • To integrate Salesforce with other systems, such as ERP or CRM systems.

For example, imagine you are the Salesforce admin for a multinational corporation with a large sales team spread across different continents. The team members update customer interaction data in Salesforce throughout the day, and this data needs to be reflected in the company’s central database in real-time.

Another example could be a marketing agency managing multiple campaigns for various clients. The agency uses Salesforce for client relationship management and a separate tool for campaign management. When a client’s information is updated or a new client is added to Salesforce, the campaign management tool needs to reflect these changes right away to ensure the campaigns are targeted appropriately.

The Role of CDC in Data Replication

Data replication involves three stages: initial copy, continuous synchronization, and reconciliation of duplicate data. CDC specifically focuses on the second stage – continuous synchronization. It captures the deltas of Salesforce data for new and changed records, allowing you to keep your external system updated.

For example, let’s say you have a human resource (HR) system that holds employee records from Salesforce. By receiving change events through CDC, you can synchronize the employee records in the HR system and process the corresponding operations, such as insertions, updates, deletions, or undeletions. With near real-time changes, your HR system will always have the latest data.

Comparing CDC with Other Data Synchronization Methods

When it comes to synchronizing data in Salesforce, organizations have several options:

  • Manual data exports from Salesforce and subsequent imports into the external systems
  • API calls to update external systems, which can be time-consuming and resource-intensive. Not to mention, there are limits on API calls in Salesforce.
  • Using bulk data loading tools like Data Loader, adds additional steps and can be an inefficient process.
  • Polling external systems for data changes can be inefficient and resource-intensive.

CDC offers distinct advantages over traditional batch updates and polling mechanisms. Manual exports and imports are time-consuming, and API calls are limited in Salesforce and can quickly add up when you’re trying to constantly sync data between multiple platforms.

Change Data Capture in Practice: Relevant Business Scenarios

The real value of Change Data Capture (CDC) in Salesforce becomes evident when we consider real-world business scenarios. Here are a few examples:

  1. E-commerce Businesses: In an e-commerce setup, prices, stock availability, and product descriptions might change frequently. By utilizing CDC, these changes can be instantly reflected on the website, keeping customers updated and preventing potential dissatisfaction caused by outdated information.
  2. Customer Service: Imagine a scenario where a customer’s contact information changes. With CDC, this change can be immediately captured and reflected across all customer touchpoints, ensuring consistent communication and enhancing the customer experience.
  3. Financial Services: CDC can be instrumental in keeping track of changes in financial data such as portfolio values, market indices, or customer credit information. This real-time synchronization can help in timely decision-making, risk assessment, and maintaining regulatory compliance.
  4. Healthcare Industry: Patient data is continually updated in healthcare settings. CDC can track these changes, ensuring all healthcare providers have access to the most current patient information, which is critical for accurate diagnosis and treatment.

Any scenario where real-time data synchronization can enhance operational efficiency, customer experience, or decision-making accuracy is an ideal use case for Salesforce’s Change Data Capture.

Limitations of Change Data Capture

Before diving into the implementation process, it’s essential to understand some of the limitations of CDC in Salesforce. Currently, only standard objects and a few custom objects are supported for the CDC. Additionally, there is a limit on the number of fields that can be tracked per object. Make sure you carefully select which fields are most important to your business processes and track those.

CDC is available as an add-on feature for available in both Salesforce Classic and Lightning Experience. To begin the implementation process, you’ll need active Enteprise, Performance, Unlimited, and Developer editions. Sorry, Essentials and Starter users!

It is also important to note that CDC is not recommended for audit trails based on record and field changes or updating the UI for multiple users in apps subscribed with CometD or Pub/Sub API. CDC is designed to keep downstream systems in sync but not individual users. If multiple users are subscribed through CometD or Pub/Sub API clients, it may hit the concurrent client limit.

How to Implement Change Data Capture in Salesforce?

Step 1: Enable Change Data Capture in Salesforce

The first step is to enable CDC in your Salesforce org. To do this, go to Setup > Data Integration Rules > Change Data Capture and click on the Enable button.

Step 2: Create a Change Data Capture Event

Next, you need to create a change data capture event for the object you want to track changes for. Under the Change Data Capture menu, click on Add New Entity and select the object you want to track. You can select up to five entities, including standard and custom objects.

To select the objects for which you want to receive change notifications, you can use either the user interface or the Metadata API and Tooling API.

User interface: In Setup, go to Change Data Capture and click Edit. Select the objects for which you want to receive change notifications and click Save.

Metadata API and Tooling API: Use the ChangeEventEnabled object to enable CDC for specific objects.

Once you’ve selected your object, you will need to choose which fields you want to track changes for. You can select up to 5 fields per event, so choose wisely. Keep in mind that if a record has multiple changes in a single transaction, only one change event will be generated.

Step 3: Choose the External System to Sync Changes With

You can now choose which external system you want to sync changes with. This can be a pre-configured Salesforce org or an endpoint that supports HTTP requests. If choosing an endpoint, make sure it is able to handle incoming POST requests. If you are choosing to sync changes with an endpoint, you will need to provide the URL of the endpoint and the authentication credentials required to access it.

Step 4: Add Actions for Your Change Data Capture Event

Once you’ve set up the basic event, you can add actions that will be triggered when a change event is generated. This can include updating records in your external system, sending out notifications, or triggering workflows. You can add multiple actions to your change data capture event. The actions will be executed in the order in which they are listed.

Step 5: Test Your Change Data Capture Event

Before activating your change data capture event, it’s always a good idea to test it. This will give you a chance to make any necessary adjustments before going live. You can test your change data capture event by creating a sample record and making changes to it. Then, you can check your external system to see if the changes have been synced correctly.

Step 6: Activate Your Change Data Capture Event

Once you’re satisfied with your event, go ahead and activate it. Now, every time changes are made to the selected fields in your chosen object, a change event will be generated and synced with your external system in real time.

Once you have enabled CDC for the objects you want to monitor, you can start receiving change notifications by creating a change event subscription.
Here are some additional technical details about CDC events:

  • Published in JSON format.
  • Published to a channel, which is a logical grouping of events. You can create custom channels to organize your events by object, topic, or other criteria.
  • Can be consumed by a variety of applications, such as streaming data processors, message queues, and batch-processing systems.
  • Can be stored in a variety of data stores, such as data warehouses, NoSQL databases, and cloud storage.
  • You can subscribe using CometD, Pub/Sub API, or Apex triggers and capture field changes for all records.
    Conclusion

Change Data Capture offers secure and scalable event streaming to downstream systems. It enables you to keep external systems in sync with Salesforce data and receive notifications for various record changes. By implementing CDC, you can keep your external data current, improve decision-making, and streamline business processes.

Minimize the firefighting.
Maximize ROI on pipelines.

icon icon