In my Managed Package I have a
CustomFlow__e Platform event with a
Flow__c text field. Dependant on the value of this field different Flows should be triggered.
What is the best way to do that?
Option 1: Let the flows find out: As far as I found out all flow candidates could check (within a Decision node) if they are the right flow. But that would make candidate flows more complicated and I couldn’t find a good way to compare the event field with the current flows name. Is there a way to get the current flows API name in FlowBuilder?
Option 2: Let an Apex trigger delegate: I like that a bit more. Especially as I hope I can make this Gatekeeper Apex class part of my package and prevent others from circumventing it. But I am unsure how to do it.
- Can I just check the
Flow__cfield in Apex and resend the same event to the right flow?
- Can I prevent that people outside of this mechanism directly subscribe flows to my package event?
- Is there any difference limit-wise between the two options?
- Can I define an event "consumed", so that other subscribers don't receive it?