the CDC feature looks great. However, the Update events only contain the changed fields after the update. Is there a way to also get the original values of the changed fields before the update? This is important to implement rollback and undo. Thanks.
1 Answer
The short answer is No. Change Data Capture is not intended to provide the prior values, instead only the values which have changed with the transaction. It's a mechanism which can be effectively used for data replication in external system as soon as data in source system changes.
CDC is defined as :
In databases, change data capture (CDC) is a set of software design patterns used to determine (and track) the data that has changed so that action can be taken using the changed data. Also, Change data capture (CDC) is an approach to data integration that is based on the identification, capture and delivery of the changes made to enterprise data sources.
The same pattern is utilized in Salesforce, below excerpt is from trailhead. You can go through the trailhead for more information on how CDC works in Salesforce.
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.
For any system utilizing CDC subscriptions, it should be the responsibility of the receiving system to identify the "delta" change and then take the action accordingly. It can be implemented as required, as once the external system receive the CDC event, they can then identify the changes from the prior values (which the external system will always have) and then decide the course of action.