Hot answers tagged

28 votes
Accepted

Extension packages & Licence Management in 2GP

Thanks for the question! I've created an answer in three parts, each one meant to address a specific question you've asked. PART ONE: How to Create Second-Generation Extension Packages PART TWO: How ...
user avatar
15 votes
Accepted

Best practices for breaking 1 GP monoliths into 2GP modules

This is a great topic. Many Salesforce Partners are exploring ways they can leverage 2GP today, even as they wait for 1GP=>2GP migration which is currently available only as a developer preview (...
user avatar
15 votes
Accepted

Modularize (existing) LWC for reuse and flexible distribution

This is a complex topic and I’m going to do my best to give some quick pointers but we could fill an entire white paper on this theme and I’m sure that are some things that I might overlook. Inter-...
user avatar
  • 3,928
9 votes
Accepted

I want to package (unlocked 2GP) a Digital Experience; what metadata do I need?

It's quite a long journey to work out what metadata you want to package in 2GP since you have to manually add all those dependency metadata items for yourself. Since Salesforce doesn't yet provide ...
user avatar
  • 27.3k
8 votes

Second gen package error about a component being a scratch org ancestor? What does this mean?

I just ran into the same issue. Trying to install my namespaced package into a scratch org with the same namespace. You need to create a scratch org without a namespace using the --nonamespace flag ...
user avatar
  • 123
8 votes
Accepted

Converting First Generation Managed Package to Second Generation (2GP) Packages

November 2020 Answer Converting from 1GP to 2GP is in Developer Preview in the Winter '21 (Oct 2020) release. You can join the Partner Community group which has all of the instructions for getting ...
user avatar
  • 2,325
7 votes

fflib as Second Generation Managed Package (2GP)

I'll start this answer by recognizing that questions which solicit opinions, rather than objective answers, are frowned upon on StackExchange. Having said that, the question was framed beautifully and ...
user avatar
6 votes
Accepted

How update Managed Packages (2GP) if one of the Apex classes is scheduled Apex

According to this question on the Developerforce platform, a user discovered that you can install an update even while a Schedueable class is scheduled. I can't find any documentation on the matter, ...
user avatar
  • 433k
6 votes

Packaging Connected App in 2gp package - CLI says package is deleted?

You don't actually need to package the Connected App, especially when all/many of your clients use the same connected app with the same secret/ID and same mobile app (for example). The important thing ...
user avatar
  • 27.3k
5 votes

Can a 2GP package include a post install page?

I raised this on the Partner Forums too. I got the following from two of the guys at Salesforce. Firstly Dileep Burki: The postInstallURL supports the specification of a URL to which the installer is ...
user avatar
  • 27.3k
5 votes
Accepted

ERROR running force:org:create: We don’t recognize this namespace: x. Did you register it in your Dev Hub org?

The documentation specifically says: Sign up for a new Developer Edition org I.e. you are right; you must have an org on which the namespace is defined and the (recommended) way of doing that is to ...
user avatar
  • 27.3k
5 votes
Accepted

2GP Create Package Version Fails when running tests

Using System.RunAs in your test methods is the recommended way to solve these in Test class execution. This ensures that the Test Execution context does not depend on the current user in the org. This ...
user avatar
5 votes
Accepted

Include two different package Directories during unlocked package creation

No, you're not missing anything. Each package may only be one directory. From your question, it appears you want two packages, with the force-app package depending on the common package. { "...
user avatar
  • 433k
5 votes
Accepted

How do we handle additions to page layouts with SalesforceDX / 2GP?

The only reasonable way to handle a page layout setup, given the dependencies required, is to make the page layout a package that actually depends on all of the other packages. This has the ...
user avatar
  • 433k
5 votes
Accepted

Apex compile failure on package installation

As at Spring '21, 2GP managed packages do not support component deletion, as covered in the 1GP vs 2GP gap documentation. A rename is equivalent to delete (old name) and add (new name). Salesforce ...
user avatar
  • 27.3k
5 votes

Extension packages & Licence Management in 2GP

2GP managed packages only appear in the LMA after security review has been passed (as you have pondered). (Note that, as an aside, without the security review being passed it is actually impossible to ...
user avatar
  • 27.3k
5 votes
Accepted

How do I package an upgradable Experience Builder Site?

This seems so simple on the face of it, but ends up quite difficult to achieve. I did manage, and on the way learned quite a bit. The main learning points: You have to have just the right metadata ...
user avatar
  • 27.3k
4 votes
Accepted

How to use second generation packaging (2GP) for a community?

The packaging for a second-generation package takes place in a "behind-the-scenes" scratch org that Salesforce calls a build org. That build org needs to be configured with the right ...
user avatar
  • 86.8k
4 votes
Accepted

Change version number scheme in sfdx-project.json

This isn't currently allowed because it's not necessarily a good idea. The way versions work in Salesforce is that each version installed is tracked by the platform. Metadata that depends on a version ...
user avatar
  • 433k
4 votes

'ParentId' field missing when deploying ExperienceBundle - 2GP

If you have enabled the ExperienceBundle Metadata API in the Dev Hub and you're still getting this error, remove the <networkMemberGroups> from the Network file of your Community. Due to a bug ...
user avatar
4 votes
Accepted

FLS check in 2GP

So in Apex Tests, you can use the RunAs feature to do this - basically, create a user in the test, assign a basic profile (the new Minimum Access one is helpful for this), and then assign the ...
user avatar
4 votes
Accepted

2GP Extension Package With Dependencies on External Packages

It's definitely possible to create 2GP dependent packages where the Parent Package is Health Cloud, FLS, or any other Managed/Unlocked package app. You will need the Health Cloud Package to be ...
user avatar
4 votes
Accepted

Enabling Unlocked Packages and 2GP on a HUB

What will happen to 1GP packages if we turn on "Enable Unlocked Packages and Second-Generation Managed Packages"? Nothing. But there's an assumption here that cannot be correct: my company ...
user avatar
  • 86.8k
4 votes

2GP Workflow and Upgrade Questions

Do I have to create a scratch org to be able to use 2GP? Yes, 2GP packages are completely developed in scratch orgs. Or can I create my changes in the SF developer org, test, and push to production ...
user avatar
  • 86.8k
4 votes
Accepted

2GP push error modify managed object

This is currently a Known Issue. There is no feasible resolution you can undertake. It's related to Custom Fields on Custom Metadata Types. My understanding, as of 2021-07-26, is that this issue is ...
user avatar
  • 86.8k
4 votes

fflib as Second Generation Managed Package (2GP)

G'day folks. Apologies for being a bit late to this discussion. @lightxx -- There are pros and cons about separating the fflib classes out to a new package. All things being equal, it makes sense to ...
user avatar
3 votes

How update Managed Packages (2GP) if one of the Apex classes is scheduled Apex

Just to add to this, it definitely use to be an issue in 1GP packages, which is why you see posts about it. I think it was Dan Appleman who suggested using this pattern in scheduled jobs to avoid ...
user avatar
3 votes
Accepted

2GP managed package: cannot create a patch release

It turns out the error message is a complete red herring; this is nothing to do with communities and all to do with not having had patch version creation enabled on the package's namespace org. This ...
user avatar
  • 27.3k
3 votes
Accepted

Can I delete a Platform Event from a Released 2GP Managed Package?

Summarizing comments: Second-generation packaging currently does not allow deletion of managed components of any type. It's on the list at Gaps Between First-Generation and Second-Generation Managed ...
user avatar
  • 86.8k
3 votes

SFDX 2GP: cannot create new managed package version

I worked with a colleague on this. The answer was to create the new package version as 1.1.0-1. For some reason, using 1.0.3.0 was not accepted. Having the beta version number be something other ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible