13

Use case:

PROD has a working Platform Event Foo__e with corresponding subscriber trigger FooTrigger as follows:

trigger FooTrigger on Foo__e (after insert) {
  .. do work
}

When a new sandbox (cs50) is created from PROD (Winter 18), the trigger never executes when the Platform Event is published:

  • Debug log for Automated Process never registers any entries
  • Side effects of FooTrigger (subscriber to the Platform Event) never persisted

Why would this be?

1 Answer 1

16

Turns out that you have to actually go into the sandbox (just refreshed from PROD) and recompile the subscribing trigger for SFDC to recognize it as available to the Platform Event subsystem.

In a way, this is like the use case wherein Schedulable classes are not available in the Force.com UI Schedule Apex Classes unless you recompile that class and/or run test methods against thay class. (I've seen similar SFSE for invocable methods not appearing in Process Builder)

UPDATE: This still seems to be true with triggers @V41 as of June 2018. Support tix filed and Platform Events PM notified

UPDATE 2: From SFDC Support: With further investigation, I was able to find few previous case where another customer had same issue which was resolved by recompiling Triggers. On other hand, I also acknowledge, these should be working after refresh. Please grant me some time to actually reproduce these on my end and would raise these up to higher experts to be addressed.

UPDATE 3: From SFDC Support: ...we have now raised these request to R&D for further investigation

UPDATE 4: This is now a Known Issue. If you are affected or plan on using trigger subscribers to Platform Events, then please mark the KI accordingly.

UPDATE 5: Known Issue is now "scheduled" meaning that it will be fixed in Winter 19 Patch 4.0 (yea!)

7
  • Is there any suggested workaround for managed platform events? We have a managed package installed that contains a platform event with a trigger. In the Prod after install its working fine, however upon SB refresh the trigger is not listed as an subscriber of the event. I have no way to recompile the packaged trigger in the SB Org since its managed. Any suggestions? Jul 12, 2018 at 7:58
  • @RobertMéndez I would contact the vendor and have them file a support case This is a SFDC issue. You can also go to the Platform Events Success Community and raise this with the PM
    – cropredy
    Jul 12, 2018 at 13:10
  • @RobertMéndez - cockamamie idea for workaround: reinstall package in sandbox.
    – cropredy
    Jul 12, 2018 at 15:54
  • Regarding the reinstall suggestion: - uninstall and reinstall: not possible due to many custom enhancements relating to packaged components - reinstall with same version: did not fix the issue - reinstall with new version: we created a dummy patch release and uploaded it - we are also the package owner ;-) -> did also not fix the issue. So i guess its an SF Case from here on. But thanks for the help Jul 13, 2018 at 7:34
  • I created a new question to get more visibility on the issue: salesforce.stackexchange.com/questions/224934/… Jul 13, 2018 at 8:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .