Fail to deploy Event + Flow from Dev to 1GP Packaging org

I try to deploy a custom Platform Event MyEvent__e and a Flow MyFlow referencing it as Resume event for a Pause Element. Both worked perfectly in my non-namespaced developer org but when deploying to a namespace org it fails with

[Flow FlowName] OnResumeEvent (Pause Configuration) – Resume event type “MyEvent__e” doesn’t exist or isn’t supported by your org.

Answer

If it is intended to be included in the package, you need it to be namespaced – I’ve noticed that flows include namespace prefixes in API name references when created on namespaced orgs and don’t cope well when these prefixes are omitted**. This is fine for both 1GP and 2GP managed package development as long as you develop on scratch orgs with the package namespace. If you are developing 1GP on dev orgs, you’re going to have to do “namespace twiddling”.

Namespace twiddling is required when doing development of 1GP managed packages on dev orgs. In this case you need to set a bespoke namespace on the relevant dev org(s) and simply run global search/replace between the official and dev org namespace prefixes on retrieve or before deploy.

This was made easier for us by using Illuminated Cloud which has built-in support for this, but only as long as your dev org has a namespace too; for some cases we also needed to use “Substitution Rules” to ensure substitution of the namespace didn’t also affect irrelevant parts of the code. These are covered in the IC2 documentation).

**: Most packaged metadata copes without namespace prefixes well (though some don’t, such as Aura components and now Flows). It was actually adding Aura components to our package that forced us to adopt first namespace twiddling then switch to SFDX and scratch orgs with namespaces.

Attribution
Source : Link , Question Author : Shivankar Raina , Answer Author : Phil W

Leave a Comment