A comprehensive guide to Scratch Org Snapshots

Scratch Org Snapshots was a long-awaited feature in the Salesforce ecosystem. After a private pilot phase, it entered public beta with the Spring '24 release, providing a new tool for managing Salesforce development environments.

  • Published 19 Apr 2024
  • 7 mins read
A comprehensive guide to Scratch Org Snapshots
Table of contents

Now with the Summer '24 release, Salesforce announced making snapshots generally available (GA).

But what are these snapshots? Scratch Org Snapshots capture the complete configuration and data of a Salesforce Scratch Org at a specific point in time.

This article is a complete guide for mastering Scratch Org Snapshots, which can potentially revolutionize your development workflow. I will explain Scratch Org Snapshots, how they can be used to quickly create dev environments, and highlight their unique benefits.

As a bonus, I will guide you through Hutte, a cutting-edge platform that streamlines org snapshot management, making it less complex and more efficient.

Do you want to speed up your Salesforce development process and minimize the time it takes to create and clone organizations? Dive in!

Understanding Scratch Org Snapshots

Scratch Org Snapshots capture the entire state of a scratch org at a given point in time. They serve as frozen snapshots of an org's configuration, metadata, and data. This provides Developers with a powerful tool for managing and replicating development environments.

Instead of manually configuring orgs or relying on cumbersome setup processes, Developers can simply clone a pre-configured snapshot to set up a new scratch org in seconds. This ensures consistency during the development, testing, and deployment phases.

Scratch Org Snapshots consist of a few key components:


This includes the org shape, editions, limits, and features of the Salesforce environment. By capturing configuration settings in a snapshot, Developers can ensure that new orgs are deployed with the same org shape as the original, maintaining consistency across different environments.


Scratch Org Snapshots store the Salesforce environment's metadata, including custom objects, fields, Flows, and Apex classes. This allows Developers to replicate the structure of their orgs accurately and ensure that any changes made in one environment can be easily transferred to others.


In addition to the configuration and metadata, Scratch Org Snapshots also capture the data that existed in the organization when the snapshot was created. This includes data records, relationships, and all sample data used for test purposes. With the data in the snapshot, Developers can create fully functional replicas of their orgs, enabling comprehensive testing and debugging.

How snapshots fit in the development lifecycle

We know that scratch orgs enable Developers to experiment freely without compromising production data as any changes made in it can be easily discarded or undone. Scratch Org Snapshots take it to another level. These snapshots help create scratch orgs with data easily without having to create one from scratch.

Salesforce allows you to create a Scratch Org Snapshot only from a scratch org or vice versa. Also, neither can replace Salesforce sandboxes for UAT (user acceptance testing). Here's why:

  • Sandboxes offer more flexibility in data retention and configuration persistence than scratch orgs, but depending on the sandbox type, they have stricter limits on data storage and usage.
  • Full copy sandboxes may have higher data limits but are more expensive and slower to refresh.
  • Due to their lightweight nature, scratch orgs have rigid data and configuration limits, making them less suitable for UAT, where realistic data volumes and configurations are needed for thorough testing.

Get started with Scratch Org Snapshots

Before you get started with Scratch Org Snapshots for your Salesforce development projects, there are prerequisites that you need to meet:

Installing the Salesforce CLI (command line interface) on your computer is important. This tool provides a set of commands that lets you interact with Salesforce orgs and perform various development tasks.

Enable Dev Hub

Enable the Dev Hub feature in your Salesforce org. Dev Hub allows you to create and manage scratch orgs and enable other Salesforce DX features.

⚡️Author's note: This feature works in both Salesforce Classic and Lightning Experience interfaces.

Enable Scratch Org Snapshots (beta)

Enable the Scratch Org Snapshots feature in your Dev Hub org. This allows you to capture snapshots of scratch org configurations for replication or version control purposes.

Enabling Dev Hub and Scratch Org Snapshots (beta) feature in your org

To activate Dev Hub and Scratch Org Snapshots (beta) in your Salesforce org, simply follow these steps:

  1. Log in to your Salesforce org as an administrator.
  2. Navigate to "Setup" by clicking on the gear icon in the page's top-right corner.
  3. In the left-hand sidebar, search for and select "Dev Hub."
  4. Click on the "Enable Dev Hub" button and proceed with the prompts.
  5. Once Dev Hub is activated, head to "Scratch Org" in the left-hand sidebar.
  6. Click on the "Enable Scratch Org Snapshots" button and follow the prompts to activate the feature in your org.

Voila! You have completed the steps to start with Scratch Org Snapshots in Salesforce DX. Using CLI commands, you're now equipped to create, manage, and replicate scratch orgs with snapshots.

Assign user permissions and licenses to Scratch Org Snapshots (beta)

If you want non-admin users to be able to create and access snapshots in Salesforce, you need to assign them the proper license and permission set. While Dev Hub administrators can do this by default, it is important to ensure that other users have the necessary permissions for smooth collaboration.

  1. Sign in to your Dev Hub organization using the admin user credentials to get started.
  2. Navigate to the "Setup" menu.
  3. Create a new permission set.
  4. Within the "Object Settings" section, locate and select "Org Snapshots."
  5. Under "Object Permissions," click on "Edit," and then choose "Read," "Create," and "Delete."
  6. Optionally, you can select "View All" to grant users visibility into snapshots created by others.
  7. Additionally, you may choose "Modify All" to enable users to delete snapshots created by others.
  8. Once you've made your selections, save your changes.
  9. Next, click "Manage Assignments," followed by "Add Assignments."
  10. Select the users to whom you wish to assign these permissions.
  11. Click "Assign" and "Done" to finalize the assignments.

How to create Scratch Org Snapshots

Here comes the exciting part! The Scratch Org Snapshot functionality allows you to freeze your org's configuration, data, and metadata so that you can easily recreate it later.

After you have authorized Dev Hub, you need to create a scratch org to take a snapshot of. To create a scratch org, run the following command in your terminal:

Sf org create snapshot --name <your_snapshot_name> --source-org <your_scratch_org_alias> --target-dev-hub <your_dev_hub_alias> --description "<optional_description>”

Replace the following code with your details:

  1. <your_snapshot_name>: A unique name for your snapshot.
  2. <your_scratch_org_alias>: The alias of the scratch org you want to create a snapshot of.
  3. <your_dev_hub_alias>: The alias of your Dev Hub org.
  4. <optional_description>: A brief description of the purpose of the snapshot.

For example:

sf org create snapshot --name VCsnapshot1 --source-org ScratchOrgforVC --target-dev-hub rsales 

While creating the snapshot, wait for the command to complete and check the terminal for progress messages. It enables faster and more efficient development by:

  • Reusing existing scratch org configurations – There is no need to configure scratch orgs with the same settings and data repeatedly. Create snapshots of your desired setups.
  • Collaboration and testing – Share snapshots with your team to create consistent development environments for collaboration and testing.

How to create a scratch org based on a snapshot

Author's note: Remember that the snapshot and desired scratch org must belong to the same Dev Hub org. I recommend creating a scratch org definition file that acts as a blueprint for your scratch org.

Here is a step-by-step guide on how to create a scratch org based on a Scratch Org Snapshot in Salesforce DX:

Salesforce DX setup

You must have Salesforce DX installed and configured (for the development experience) in your software development environment, such as VS Code.

Existing snapshot

I am sure you already have an instance of a scratch org created. If not, follow the instructions for creating a snapshot first.

Execute the command "sf org create scratch:"

Launch a terminal or CLI command in the Salesforce DX project directory:

sf org create scratch --definition-file Config/snapshot-scratch-def.json --alias your-scratch-org-alias --target-dev-hub your-dev-hub-alias --wait 10

Replace "snapshot-scratch-def.json" with the name of your definition file

Generally, it takes Salesforce a little longer to execute the request. Hence, increase the "--wait" value to ensure the command doesn't die out before execution.

Some Salesforce Scratch Org Snapshot CLI commands

Create: org create snapshot

Use the command to create a snapshot of your scratch org. Creating snapshots using CLI commands for Salesforce scratch orgs provides a convenient way to capture the org's state at a specific point in time.

List: org list snapshot

The list command is used to see all the snapshots you've created and learn about each one. It helps you keep track of your org's status and see how your development and testing work is going.

Delete: org delete snapshot

This command lets you delete a Scratch Org Snapshot. When you're handling Salesforce Scratch Orgs, deleting snapshots is essential to keep everything tidy and running smoothly.

Get: org get snapshot

You can use this command to get details of the snapshots that have already been created.

Get help with command syntax in the terminal

You can use the "--help" and "-h" flags in the command window to get different levels of help – detailed or short. For example, "sf org create snapshot -help."

Use cases and benefits of snapshots

Better development and testing processes

Developers can quickly create orgs from a snapshot, making testing and development easier without setting up new orgs or creating sandboxes for testing. This avoids doing the same setup again and again, which saves time and lowers the chance of mistakes.

Moreover, Developers can smoothly switch between different org setups, allowing them to work on various features or fix bugs simultaneously without redoing configurations.

Helping teams work together better

When Developers use a snapshot to start new orgs, everyone on the team gets the same starting point. This means no more manual setup, which reduces mistakes and keeps things consistent. With snapshots, sharing the same setup with team members is easy. Instead of writing down and passing around all the setup details, Developers can simply share the snapshot.

Deployment and rollback

If issues arise during deployment, Scratch Org Snapshots enable quick rollback of changes. Developers can use snapshots to restore the org to a previous state, which creates a safety net and builds confidence during production deployments.

In short, Scratch Org Snapshots' main advantage is that you can create a perfect dev environment with the right metadata, data, and org shape. Moreover, it also helps you quickly create replicas of scratch orgs for other Developers and QA.

There are, however, a few limitations, such as:

  • You can only create five snapshots per Dev Hub daily
  • You can have a maximum of five active snapshots at a time
  • Snapshots expire after 30 days.

Scratch Org Snapshots made easy with Hutte

If you're familiar with Hutte, you'll appreciate its unique features. Hutte's strength lies in its commitment to early adoption and continuous improvement, ensuring a superior user experience. Its user-friendly interface makes it particularly appealing to those who prefer less command-line interaction.

Using Hutte's UI, you can create and manage your org snapshots from any scratch org and effortlessly apply them when creating new scratch orgs. Alternatively, you can build a personalized Scratch Org Pool directly from your existing snapshots.

But before you start, activate snapshots on your Dev Hub linked to Hutte.

Ready to try it out?

Last updated: 11 Jun 2024