1

After doing more than one operation in a single transaction, the change data capture event trigger does not get the two expected events.

For example, we will create and update a Lead in the same transaction:

Lead myLead = new Lead();
myLead.Name = 'test';
insert myLead;
myLead.Name = 'updated';
update myLead;

A trigger created in the LeadChangeEvent object gets the following record in its Trigger.New map:

  • Lead: Operation=INSERT, Id=00QXXXXXXXXXX, Name='updated'

While this could be somehow considered as an expected behavior, it doesn't do the job of offloading work from the transactional triggers as the expected events aren't received.

Another example:

Lead myLead = new Lead();
myLead.Name = 'test';
insert myLead;
myLead.Name = 'updated';
update myLead;
delete myLead;

This doesn't trigger any CDC events at all.

At the end, we created our own change events framework using a triggerHandler, platform events and a record field as a flag for execution, but the question is: ¿Did we miss something in our implementation?.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.