I have created a Platform Event with some fields, and a trigger for it. I have also created a VF Page and subscribed to that event.
From the developer console, I publish an event in this manner.
List<Stripe_Authorize__e> publishEvents = new List<Stripe_Authorize__e>();
Stripe_Authorize__e eve = new Stripe_Authorize__e();
eve.SessionID__c = '123';
eve.PaymentIntentID__c = '1234';
eve.Transaction_Helper_ID__c = '66';
eve.Post_Authorization_Status__c = '1' ;
publishEvents.add(eve);
// Call method to publish event
List<Database.SaveResult> results = EventBus.publish(publishEvents);
// Inspect publishing result for each event
for (Database.SaveResult sr : results) {
if (sr.isSuccess()) {
System.debug('Successfully published event.');
// Get asynchronous operation ID.
System.debug(EventBus.getOperationId(sr));
// The getOperationID call above is equivalent to the err.getMessage() call
for(Database.Error err : sr.getErrors()) {
System.debug('Error returned: ' +
err.getStatusCode() +
' - ' +
err.getMessage());
}
} else {
for(Database.Error err : sr.getErrors()) {
System.debug('Error returned: ' +
err.getStatusCode() +
' - ' +
err.getMessage());
}
}
}
So far so good, I'm getting in my VF page the message BUT The trigger of that event never fires. I'm getting these messages from the debug log
USER_DEBUG|[17]|DEBUG|Successfully published event.
USER_DEBUG|[19]|DEBUG|6fe2cd26-1161-42a3-b229-886d18cabaaa
VARIABLE_SCOPE_BEGIN|[22]|err|Database.Error|true|false 15:07:29.1
(14367228)|VARIABLE_ASSIGNMENT|[22]|err|"Error [statusCode=OPERATION_ENQUEUED, code=[xmlrpc=-1, statusCode=OPERATION_ENQUEUED, exceptionCode=null, scope=PublicApi, http=202], message=6fe2cd26-1161-42a3-b229-886d18cabaaa, fields=null]"|0x697034ba
I can't understand what this message means, and if that has to do with the non-firing trigger.
I have the debug "Automated Process" To be active and it's not showing I also tried publishing the event from "workbench" through Rest Post the same thing happens, I receive the event on the VF Page but Trigger not firing.
(just to mention, when I did start this few days ago, I did manage to notice the "Automated Process" but not anymore.
Maybe a limit problem? I hope someone can help with this.
here is also the trigger :
trigger StripeAuthorize on Stripe_Authorize__e (after insert) {
system.debug('Stripe Authorise Trigger - Platform Event');
List<Transaction_Helper__c> thoList = new List<Transaction_Helper__c>();
for (Stripe_Authorize__e event: trigger.new)
{
Transaction_Helper__c tho = new Transaction_Helper__c(id = event.Transaction_Helper_ID__c);
tho.Payment_Intent__c = event.PaymentIntentID__c;
thoList.add(tho);
}
insert thoList ;
}