Test Drive Your Scratch Org

Now that you’ve got a Chef (the Dev Hub) and a Recipe (your scratch org definition file), let’s cook up a Scratch Org!

In this exercise, you will…

  • Use the Salesforce CLI to create a scratch org
  • Open the new scratch org
  • Review the expanded licenses provided by the “Partner Developer” scratch org edition
  • Observe how orgPreferenceSettings and securitySettings affect scratch orgs

Use the Salesforce CLI to create a scratch org

Anytime you use the CLI to create a scratch org, you’ll be using the force:org:create command.

This command uses more flags than you’ve seen previously. Take a moment to read the table below the command to learn what each one does.

Please Note: This command may sometimes take 1-2 minutes to complete. If it feels like it’s taking awhile, hang tight and it should return shortly.

Execute this command:

sfdx force:org:create -a PkgScratch -s -f config/project-scratch-def.json
Salesforce DX Command / Flags Description
force:org:create Creates a scratch org using values specified in a configuration file
-a (setalias) Sets an alias for for the created scratch org.
-s (setdefaultusername) Sets the created org as the default username.
-f (definitionfile) Path to a scratch org definition file.

After executing the above, your terminal should look something like this:

Open the new scratch org

Once your scratch org has been created, it’s time to open it up and take it for a spin!

Execute this command:

sfdx force:org:open
Salesforce DX Command / Flags Description
force:org:open Opens an org in your browser.

After executing the above, your terminal should look something like this:

  1. You may see a message that the CLI is waiting to resolve your scratch org’s custom domain name. This will automatically clear once the domain is resolved.
  2. If your default browser does not automatically open to your scratch org, you can copy and paste the special login URL that the CLI provides.

Note: The URL is highlighted yellow for emphasis in the screen shot. It will not appear like that on your screen.

Review the expanded licenses provided by the “Partner Developer” scratch org edition

If your using a DevHub in a Partner Business Org, you’ll be able to use the Partner Developer edition of scratch orgs which comes with all of the expanded licenses that a Partner Developer Edition org does.

  1. From Setup->Home in your scratch org, type “company info” into the Quick Find search.
  2. Click on the Company Information setup item.
  3. Scroll to the User Licenses section to see the licenses that come with your scratch org.
  4. Do the same for the Permission Set License section.

Observe how orgPreferenceSettings and securitySettings affect scratch orgs

Take a moment to see how the other settings in your scratch org definition file affected this scratch org.

Observe the effect of orgPreferenceSettings:

  1. In the Setup Quick Find search, type “apex”.
  2. Click on the “Apex Classes” setup item.
  3. Check the “allowed limit” of Apex characters. This should read 10,000,000. Creating scratch orgs with anything set higher than 10MB will require a PM to modify a perm in your Dev Hub.

Observe the effect of sessionSettings:

  1. In the Setup Quick Find search, type “session”.
  2. Click on the “Session Settings” setup item.
  3. Note that the settings “Enable secure and persistent browser caching…” has been disabled.

Updated: