I'm using Data Cloud, I've created a Calculated Insight and am trying to fire that off to the SF instance to update the contact record with a piece of information. So I'm using Data Actions with a Target of a SF Platform Event. The documentation on this is very light, but I've gathered you need Apex to subscribe to the event via a trigger on DataObjectDataChgEvent. I have the code that does this and updates the contact as needed.
My issue is I can't write a test class for this trigger, when I try to publish the event in the test class using
EventBus.publish(new List<DataObjectDataChgEvent> { ev1, ev2 });I get the following error at this line: System.TypeException: DML operation INSERT not allowed on DataObjectDataChgEvent
Makes sense since the docs for this object doesn't have create() as a supported call. However I then wonder how we can ever deploy an apex trigger on this object to prod to subscribe to the Data Action?
Hi, sorry for the inconvenience. If you don't receive a response here, we recommend reaching out to our support team for further assistance. You can do so by visiting https://help.salesforce.com/s/articleView?id=000393090&language=en_US&type=1