+ Start a Discussion
Sujendran Sundarraj 8Sujendran Sundarraj 8 

Asynchronous Apex Trigger is not working(Summer '19)

Hello All,
I am learning on Asynchronous Apex Trigger, recently introduced on summer release '19. I have created a custom object Event_testing and added it to Change Data capture and created a new trigger, that has a debug statement to capture the trigger.new values. However, The custom event trigger is not even called after the insert operation. 
Any advise would be much appreciated. 
trigger Testing_tgr1 on Event_testing__ChangeEvent (after insert) {
    for(Event_testing__ChangeEvent c : trigger.new){
        system.debug('C is '+c);
        
    }
}

Thank you.
Regards, 
Sujendran. 
​​​​​​​
pconpcon
I'm guessing this is happening in an asynchronous call and is not showing up in your debug logs because it is a seperate transaction.  Are you able to write a test using the enableChangeDataCapture and getEventBus().deliver() methods?

https://releasenotes.docs.salesforce.com/en-us/summer19/release-notes/rn_change_event_triggers.htm