function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

What are the design patterns for relating managed and unmanaged packages?

Hi guys,

I'm developing an app as a managed package. And I'm running in to two issues:
- How can I supply my customers with additional unmanaged elements to install on top of the package?
- How can I build a plug-in style managed package to work along side my core managed package?

For the first question: I'd like to include some additional parts of it as unmanaged. Things like:
- Pre-built reports
- Custom report types
- Email templates
- Customizable buttons

I have my primary managed app: JayNicsApp - Core.
Then I created two supplementary unmanaged apps: JayNicsApp - Reporting, JayNicsApp - Templates.

But when I created them, it went ahead and added all the dependancies from the managed app to the unmanaged package...
My desired outcome would be a package with just the elements that I want unmanaged and delivered to the customer. If the customer does not have the managed package installed underneath - it should fail to install. I don't want to have to add all of my code and customizations 
to an unmanaged package just for some silly reports...

For the second question:
I'd like to build another piece of managed code that can sit on top of my original core managed package. This would be something like some integrations between my custom objects and CRM objects (Opportunity, Case etc..). This integration would not come standard in the manged package core and would only be needed by customers if they had CRM and not just a Platform license.
How can I go about building that?

Really appreciate the help.
Florian HoehnFlorian Hoehn
Hi JayNic,

For the first question:
If you cannot create the package, get all the reports and/or templates and pull them down and migrate/deploy them to the other org. You can use this ant tool for it:

The second one is WAY more complex. It can be done with some new Managed Package Plugin but it is not very well documented so far. Read about Java Reflection to get some knowledge on how it works.

Hope this helps!

Ok, so manually migrating the desired components for the first question. That sucks... Developers get shafted by Salesforce again..

And for the second one I write dynamic apex to determine if my desired components/package is installed?
Florian HoehnFlorian Hoehn
Pretty much. But you can only check if classes with a certain name exist and then use them as far as I know.