Newer Version Available

This content describes an older version of this product. View Latest

Create a Scratch Org Based on a Snapshot (Beta)

The snapshot must belong to the Dev Hub that you’re using to create the scratch org. Create a scratch org definition file that references the snapshot. We recommend creating a definition file specifically for this purpose. Changing or deleting a scratch org has no effect on a snapshot.

Create the Scratch Org Definition File

The scratch org definition is the blueprint for your scratch org. It’s likely that your snapshot includes all the required features and settings to configure the scratch orgs created from it.

Using our Dreamhouse scratch org as an example, let’s create a scratch org definition file called dhsnapshot-scratch-def.json that contains only two entries: orgName and snapshot, which is the name you gave the snapshot when you created it.

Be sure you use the snapshot option instead of edition in the scratch org definition file. In beta, you can’t specify features, sourceOrg, releaseVersion, and language in your snapshot scratch org definition.

Important

Create the Scratch Org Based On Your Snapshot

It can take Salesforce a little longer to create a scratch org from a snapshot, so we suggest you increase the --wait value so the command doesn’t time out. Remember to set the --target-dev-hub flag to the same Dev Hub org associated with the snapshot.

For example:

Success! Development and testing with scratch orgs just got a whole lot easier.

Snapshot Error Codes

See Scratch Org Error Codes for details.