Newer Version Available

This content describes an older version of this product. View Latest

Link a Namespace to a Dev Hub Org

To use a namespace with a scratch org, you must link the Developer Edition org where the namespace is registered to a Dev Hub org.

Complete these tasks before you link a namespace.

  • If you don’t have an org with a registered namespace, create a Developer Edition org that is separate from the Dev Hub or scratch orgs. If you already have an org with a registered namespace, go to Step 1.
  • In the Developer Edition org, create and register the namespace.

    Choose namespaces carefully. If you’re trying out this feature or need a namespace for testing purposes, choose a disposable namespace. Don’t choose a namespace that you want to use in the future for a production org or some other real use case. Once you associate a namespace with an org, you can't change it or reuse it.

    Important

  1. Log in to your Dev Hub org as the System Administrator or as a user with the Salesforce DX Namespace Registry permissions.

    Make sure your browser allows pop-ups from your Dev Hub org.

    Tip

    1. (Required) If you haven’t already done so, define and deploy a My Domain name.
      Production orgs created in Winter ’21 and later have a My Domain by default. For information on setting up and deploying a My Domain, see My Domain in Salesforce Help.

      Why do you need a My Domain? A My Domain adds a subdomain to your Salesforce org URL so that it’s unique. As part of the Namespace Registry linking process, you’ll be logging into two distinct orgs simultaneously (your Dev Hub org and your Developer Edition org), and your browser can’t reliably distinguish between the two without a My Domain.

      Tip

    2. From the App Launcher menu, select Namespace Registries.
    3. Click Link Namespace.
      If you don’t see the Link Namespace button, make sure your My Domain is deployed to users.
    4. From Setup, enter My Domain in the Quick Find box, then select My Domain.
    5. Do you see Step b? That means you registered a My Domain, but haven’t deployed it yet. Search and go to My Domain in Quick Find. Click Deploy to Users (if it’s not there, then it is deployed).
      Log out of your Dev Hub org, then open it again.

      Deploying or renaming a My Domain may take up to an hour to take effect.

      Important

  2. Log in to the Developer Edition org in which your namespace is registered using the org's System Administrator's credentials.

    You cannot link orgs without a namespace: sandboxes, scratch orgs, patch orgs, and branch orgs require a namespace to be linked to the Namespace Registry.

To view all the namespaces linked to the Namespace Registry, select the All Namespace Registries view.