I have written a trigger on Standard platform event object 'ConsentEvent' which gets fired whenever user or contact email is updated. But I am not able to write test class for the same. I have tried the format mentioned in Salesforce documentation but the Consent Event is not fired when I change the email address in test class

//update user email address 

Any help would be appreciated

  • can you do EventBus.publish(new ConsentEvent(...)); in the test class rather than relying on the delta to changing the email address? That is, you are testing the trigger, not the OOTB SFDC functionality
    – cropredy
    Jan 13 at 18:57

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.