Monday, 7 November 2022

Pre-requisites for creating Second-Generation Managed Packages

 1. Enable Dev Hub in your Org.

2. Enable Second-Generation Managed Packaging.

3. Install Salesforce CLI.

4. Create and Register Your Namespace


Note : Developers who work with 2GP packages need the correct permission set in the Dev Hub org.

       Developers need either the System Administrator Profile or the Create and Update Second-Generation Packages permission.

       

Namespace:


1.The namespace of a managed package is created in a namespace org and linked to the Dev Hub.

we can associate multiple namespaces to a single Dev Hub.

A namespace is linked with a 2GP when you run the force:package:create Salesforce CLI command And you must specify the namespace in the sfdx-project.json file.


2.Multiple packages can use the same namespace.


3.Multiple packages sharing the same namespace can share code using public 

Apex classes and methods @namespaceAccessible annotation.


 

How to register/link a namespace ?


Login to your Dev Hub org as the System Administrator or as a user with the Salesforce DX Namespace Registry Permissions.


Some of the orgs that you use with second-generation managed packaging have a unique purpose.


1.Choose your Dev Hub Org.

2.Namespace Org.

3.Other Orgs.



Purpose of Dev Hub :


As owner of all second-generation managed packages.

To link your Namespaces.

To authorize and run your force:package commands.

Note : Salesforce recommend that your Partner Business Org is also your DevHub Org.


Purpose of Namespace Org :


The primary purpose of the namespace org is to acquire a package namespace.

If you want to use the namespace strictly for testing,choose a disposable namespace.


After you create a namespace org and specify the namespace in it, open the Dev Hub org 

and link the namespace org to the Dev Hub org.


purpose of Other Orgs :


When you work with packages, you also use these orgs: you can ceate scratch orgs on the fly to use while testing your packages.

The target or installation org is where you install the package.

No comments:

Post a Comment