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.

  1. Can I just check the Flow__c field in Apex and resend the same event to the right flow?
  2. Can I prevent that people outside of this mechanism directly subscribe flows to my package event?
  3. Is there any difference limit-wise between the two options?
  4. Can I define an event "consumed", so that other subscribers don't receive it?
  • 1
    for #4 - NO; what about Option 3 - One flow to consume the PE and delegate to subflows by passing the sobject CustomFlow__e as a variable?
    – cropredy
    Commented Dec 23, 2020 at 23:47
  • Sounds great. Can I define that this packaged flow AND the event cannot be used and modified outsize of the package? And what’s the benefit of a gatekeeper flow vs. 5 lines of Apex? Commented Dec 24, 2020 at 9:26
  • 1
    I only suggested option 3 if you wanted to localize all the PE subscription/delegation within one part of the SFDC development arsenal; I don't know the answer to #2 - you could post in the Platform Events Success Community
    – cropredy
    Commented Dec 24, 2020 at 17:57
  • @cropredy it's not possible to call subflows from a PE triggered Flow - see the idea here
    – pixelpixie
    Commented Sep 28, 2022 at 19:02

1 Answer 1


Is it possible that you might need to change the flow which gets triggered tomorrow based on value tomorrow? or use the same platform event in another scenario with another flow?

I would look at managing a mapping between the flow__c text field and the actual flow to be triggered in a CMDT and use Apex to resolve that and invoke the flow.

  1. In my opinion you will have to republish the event, which would mean the Apex will also receive it again. I would rather look to add the payload to the event, which I can pass on to the flow while invoking it.

for 2. and 4. I would look to encrypt the event payload to ensure only my subscriber and decrypt and use it.

  1. I am not so sure about it, I would expect it to be the same.

You must log in to answer this question.

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