function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bretondevbretondev 

DevHub not available in Sandbox

We want to use Salesforce DX. For this we need to enable DevHub. We can see the DevHub option in Production, but we cannot see it in our Sandboxes. Please help.
Best Answer chosen by bretondev
jprichterjprichter

Scratch Orgs and Sandboxes are unrelated. You don't create scratch orgs in sandboxes. 

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences. (src (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs.htm))

If you want to use SFDX to develop in a sandbox, check this out (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_sandboxes.htm) and more specifically, how to use SFDX to develop against any org (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop_any_org.htm).

All Answers

jprichterjprichter
DevHubs are only set up against your Production Org. See here (https://salesforce.stackexchange.com/a/197189/25289)for more details.
bretondevbretondev
Thanks for the link. The thing I don't undertstand is how can I create a Scratch Org in my Sandbox since DevHub is only in Production. We start all our developments in Sandboxes...
jprichterjprichter

Scratch Orgs and Sandboxes are unrelated. You don't create scratch orgs in sandboxes. 

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences. (src (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs.htm))

If you want to use SFDX to develop in a sandbox, check this out (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_sandboxes.htm) and more specifically, how to use SFDX to develop against any org (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop_any_org.htm).

This was selected as the best answer
bretondevbretondev
Does that mean we will not use our sandboxes anymore?
jprichterjprichter
That's entirely up to you, but sandboxes still have a place alongside scratch orgs, especially when it comes to User Acceptance and Regession Testing. For example, say you're using scratch orgs and unlocked packages. Now you're at the stage where you'd like to have your users do some UAT. You could deploy your unlocked package to a sandbox where your users can test your package.
bretondevbretondev
Thanks, I am relieved