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"?

  • Do you see option in your sandbox setup screen to enable Developer hub? I only see in my production org. – javanoob Oct 27 '17 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. – Riadh Mankai Oct 27 '17 at 23:20

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.

| improve this answer | |
  • 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 '17 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 '17 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 '17 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 '17 at 17:30
  • @sfdcfox I'm surprised the docs don't have an example. There is this: developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/… but it wants me to create a unmanaged package and select each meta data. I wish there was a select all. – Tyler Zika Oct 30 '17 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.