Andrew Hanna

Andrew Hanna

Managed Packages in Salesforce: Why 2GP Is Now the Default

Managed Packages in Salesforce: Why 2GP Is Now the Default

TL;DR: A managed package in Salesforce is a namespaced, upgradeable and IP-protected bundle of components that an ISV distributes to customer orgs, usually through AppExchange. Salesforce supports two generations, 1GP and 2GP, recommends 2GP for new apps, and since Summer '25 lets you convert a 1GP package and migrate its subscribers. Picking the format is the easy part now; running package versions through a real release pipeline is where most teams still struggle.

What is a managed package in Salesforce?

A managed package bundles Apex, objects, flows, Lightning components and other metadata under a globally unique namespace prefix, which Salesforce adds to every component's API name. According to the Apex Developer Guide, it is the format built for commercial distribution:

  • Locked: subscribers can see the components but cannot change the package contents. Some attributes stay editable after install, but those changes live outside the package.
  • Upgradeable: the developer can push upgrades to subscriber orgs, and keeping them backwards-compatible is the developer's job.
  • Protected: managed Apex is hidden from subscribers, which is why ISVs use it for their IP.
  • Reviewed: any package listed on AppExchange must first pass the Salesforce Security Review.

How is a managed package different from unmanaged and unlocked packages?

  • Unmanaged: a one-time copy. Fully editable after install, no upgrade path, no IP protection.
  • Unlocked: built for internal teams shipping modular code. Admins can modify installed components, the namespace is optional and there is no IP protection, so it is not meant for AppExchange.
  • Managed: locked, namespaced, upgradeable and licensable. The only choice if you sell an app.

What is the difference between 1GP and 2GP?

Salesforce's official comparison comes down to where the truth lives:

  • Source of truth: 1GP treats the packaging org as the source; 2GP treats version control as the source.
  • Orgs: 1GP needs packaging and patch orgs; 2GP uses neither and is owned by a Dev Hub.
  • Ownership: a packaging org owns exactly one managed package; a Dev Hub can own many.
  • Versioning: 1GP is linear; 2GP supports branches.
  • Common ground: both can go through security review and be listed on AppExchange.

Our view is simple: if your package's real history lives in a packaging org rather than in Git, every other DevOps practice you adopt is built on sand. For the details 2GP rarely puts on the first page, read the secrets of the Salesforce second-generation managed package.

Can you move a 1GP managed package to 2GP?

Yes. Package Migrations reached general availability with Summer '25, which Salesforce's developer blog framed as the top request from ISV developers. It runs in two steps: convert a 1GP version into a 2GP version with sf package convert, then migrate subscribers onto it. The documented considerations are worth reading before you start:

  • The subscriber's installed major and minor version must match the 2GP version being installed.
  • Migration is one-time per subscriber and package, and every later upgrade for that subscriber must be a 2GP version.
  • With dependencies, the order you migrate base and dependent packages matters.
  • Once converted, the 2GP package cannot move to a different Dev Hub.

The ecosystem is moving. GRAX, for one, has announced that support for its 1GP package ends on December 18, 2026. Expect more vendor notices like that, and treat your own migration as a release with a rollback plan, not a one-off script.

Why is managed package development still a DevOps blind spot?

Most of the Salesforce DevOps conversation is about moving metadata between orgs. That is the subscriber's problem: Gearset's own managed package guide, for example, centres on deploying installed packages and customizations from one org to another. The ISV's problem is different: building package versions, promoting the right one, testing installs and upgrades, and pushing to subscribers without breaking them. We have argued before that every Salesforce DevOps tool ignores package development, and it is the reason we started building Serpent.

What does a good managed package pipeline look like?

  1. Git is the source of truth. On 2GP this is the model, not an aspiration.
  2. Build versions in CI. Create package versions from the main branch and promote only the ones that pass tests.
  3. Test upgrades, not just installs. A clean install proves little; an upgrade over last quarter's version is what subscribers actually run.
  4. Test against realistic data. Serpent seeds data as part of environment setup and release pipelines, so scratch orgs and refreshed sandboxes come back populated without a manual script run, with PII masking when the data starts as production records.
  5. Plan security review early. It gates your AppExchange listing, so findings found late cost a release.
  6. Push deliberately. Backwards compatibility is yours to keep, so stage push upgrades instead of firing them at every subscriber at once.

Skipping steps three and four is how the hidden risks in a deployment process end up in a customer's org. If you build on AppExchange, see how Serpent approaches DevOps for ISVs, or go straight to 2GP CI/CD.

FAQ

Can you install a managed package in a sandbox?

Yes. Installing it in a sandbox first lets you test how its triggers and flows behave with your configuration before production.

Can subscribers edit a managed package?

Not its contents. Some component attributes stay editable after install, but those customizations live outside the package.

Does every managed package need a namespace?

Yes. Each managed package needs a globally unique namespace prefix, which Salesforce adds to component API names.

Is 1GP being retired?

Salesforce still supports 1GP and recommends 2GP for new apps. Package Migrations let you convert existing 1GP packages and move subscribers when you are ready.

Related Articles

Curious about faster shipping before you dive in? Let's talk

Commitment free!