7

I'm trying to get started with Salesforce DX and setup my "New Source of Truth". I was under the impression that you setup your production as your source of truth, but this is mentioned in a trailhead

To get started with Salesforce DX, you choose an org to function as your Dev Hub. While you can enable Dev Hub in any paid org, it’s always best to practice somewhere other than production.

What is best practice?

Here is my situation, I develop in two org. There is a "Dev" which is Developer Sandbox. Then there is "Staging" which is a Partial Copy Sandbox.

The "Dev" is out of sync with production by almost two months. "Staging" has all the important code from "Dev", and was recently refreshed from production.

I'm assuming my Dev Hub should be setup in "Staging"?

2
  • Do you see option in your sandbox setup screen to enable Developer hub? I only see in my production org.
    – javanoob
    Oct 27, 2017 at 23:20
  • 2
    My understanding is that DebHub is just a place where you manage your scratch orgs. It doesn't mean it is the source of truth. Now I think I have the same problem than you: I want to start with DX in a client existing project, but I want to start with some code and metadata. And ideally I want to start with the content ( a copy) of orgs such as staging or UAT. But how to achieve that? I understand we can convert classic projects using unmanaged package. But in my case the package would be huge and will take a lot of point and click to build. Oct 27, 2017 at 23:20

1 Answer 1

11

Your hub org must be a permanent org. Otherwise, you'd lose all your scratch orgs when you refreshed/deleted the hub org. The "play around" suggestion stems from the fact that new permissions must be enabled, so you might want some experience with it so you don't accidentally mess something up. While you can fix those mistakes, it's better to try and work out the kinks ahead of time.

The hub org is not the source of truth (your repo is the source of truth). Instead, it is the central location that all scratch orgs are created, deleted, and accessed.

10
  • Just to clarify as well - is it correct to state that the hub org is simply a mechanism for licensing the use of scratch orgs? It has no other connection to your metadata. You could just as easily take metadata from a totally unrelated project in another org and use that to spin up a scratch org.
    – Charles T
    Oct 28, 2017 at 6:07
  • 1
    @CharlesT certainly. When you spin up a new scratch org, it's brand new with zero customizations, not even the default template customizations and sample data you'd see in a trial or Dev org. You can put any metadata you want in them, from any source you might have access to.
    – sfdcfox
    Oct 28, 2017 at 6:16
  • @sfdcfox how do I get all my meta data from production and place it in a scratch org?
    – Tyler Zika
    Oct 30, 2017 at 17:26
  • @TylerZika you retrieve it by normal means (e.g. Force.com IDE), then run force:mdapi:convert to convert it to DX format, then force:source:push to push it to the scratch org. I don't have time to write up a full demo this second, but it's pretty straight forward.
    – sfdcfox
    Oct 30, 2017 at 17:30
  • 1
    @dan You can get Free Limited Access Licenses for your developers, so you don't need to pay CRM-priced licenses for your developers, and also, it doesn't give access to any production data (e.g. Accounts or Custom Objects), aside from Scratch Org and Package-related objects.
    – sfdcfox
    Mar 23, 2021 at 12:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .