Skip to main content

I had a base 1GP managed package and 1 unmanaged packages. Recently i converted the based package to 2GP and wanted to convert the 1GP unmanaged packages to 2GP. 

I have looked for a way to do this and Unlocked packages(no namespace) seems to be the best way to do it. I have tried converting the same metadata of unmanaged package to Unlocked Package and installed in a test org, the unmanaged package fields do list under the Unlocked Package, But also under the Unmanaged package. I tried deleting the unmanaged package but it also removes the components under it. 

Need a way so i don't have to keep the Unmanaged package in the org after i have the Unlocked package. How you all are handling this scenario? 

 

#Second Generation Packages  #Generation Managed Package  #Salesforce Developer  #Solution Architects

1 件の回答
  1. 10月27日 6:53

    Hello @Abhishek Sinha

     

    Package conversion and migration to 2GP only work for managed 1GP packages. Unmanaged packages can't be converted. For those, you rebuild the package from its source. 

     

    If it's an unmanaged package:

    1. Retrieve the package's metadata into a Salesforce DX project:

      sf project retrieve start --package-name "<Package Name>" --target-org <org>

      Then convert it to source format if needed: sf project convert mdapi.

    2. Create a new package from that source. Use an unlocked package for internal/org use, or a managed 2GP package if you're an ISV distributing on AppExchange:

      sf package create --name "<Name>" --package-type Unlocked --path force-app

      sf package version create --package "<Name>" --installation-key-bypass --wait 20

    3. In existing orgs, the unmanaged components aren't linked to any package. Install the new package and test it in a sandbox first. Unlocked packages can take ownership of existing unpackaged metadata (see "Migrate Existing Metadata to Unlocked Packages" in the docs).

     

    If it's a managed 1GP package, Salesforce supports conversion and migration in three phases:

    1. Plan and test: keep releasing with 1GP. Convert and migrate only in scratch orgs or sandboxes. Get all subscribers onto the same 1GP version.

    2. Transition: convert your latest major.minor released version, promote it to released, then migrate subscribers with push upgrades (one time per subscriber). New features are still built in 1GP, then converted and push-upgraded.

    3. Fully on 2GP: confirm the move in your packaging org's Setup. After that, you can no longer create new major/minor 1GP versions (only patches for earlier versions).

     

    The subscriber's installed 1GP version must match the major.minor.patch version of the converted 2GP version you migrate them to. Migration doesn't change your metadata or subscriber data. 

     

     

0/9000