5

Is it possible to automatically create a scratch org with the same metadata as the developer hub org (like a sandbox) or do scratch orgs always start as a blank slate that's filled based on the configuration file?

1 Answer 1

6

No, scratch orgs are always "empty" when created. They're meant to be populated with metadata from your source code repository, which is the purpose of Salesforce DX. It's not "org-based development", the way that production/sandboxes are, but instead "source code-based development", where all of your configuration is in source control, and that code is the source of truth.

6
  • I will add to sfdcfox's answer and mention that the Hub Org is intended to be agnostic of the metadata in the scratch orgs... this is particularly important when handling managed packages and for the new packaging model that is coming soon.
    – binaryLady
    Jul 4, 2017 at 17:01
  • 2
    @Chance Since this answer has been posted, there is a new feature: org shape. This allows you to recreate your production's metadata using a simple command-line interface. Unfortunately, this is still in pilot, which means you need to sign up for it. It'll probably be developer preview in a release or so (hopefully, but usual "forward-looking statement" clause applies).
    – sfdcfox
    Feb 12, 2018 at 21:41
  • 2
    @Chance The point of a Dev Hub, though, is a place to organize and view all of your scratch orgs in one place, just as you'd do with if you wanted to see a list of all your sandboxes. The original intent was not to have it be a direct clone, but to be able to start from scratch, and deploy only fragments of your code base instead of every single field, object, code unit, etc. This means that a developer could set up their own unique environment in mere minutes instead of waiting hours for a sandbox copy.
    – sfdcfox
    Feb 12, 2018 at 21:45
  • 2
    @Chance And finally (apologize for all the comment notifications), most organizations have enough of a code base that doing it all in one run is impractical. You need to break this down into reasonable chunks as much as practical. Moving to DX from an existing project isn't an overnight change, it can easily take days or even weeks to fully sift through everything and get set up. New projects that start out with DX don't have to worry about that problem, of course.
    – sfdcfox
    Feb 12, 2018 at 21:47
  • 1
    @sfdcfox Thanks as always for the advice. I guess I am just struggling with DX. From an admin's perspective, I had a lot of hope for this tool because I thought it would help me develop. But it just seems that it is not the tool for the "admin-eloper" because I keep running into issues like this. I'm developing a pretty simple org, and it seems like you are saying the best step is for me to just develop in a sandbox rather than use DX and scrach orgs. Thanks again.
    – Chance
    Feb 13, 2018 at 14:48

You must log in to answer this question.

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