Scratch Orgs

Updated 3 weeks ago by Copado Solutions

Scratch Orgs Overview

According to Salesforce, "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. You can share the scratch org configuration file with other team members, so you all have the same basic org in which to do your development."

Benefits of Scratch Orgs

  • Perfect for source control-driven development.
  • Quick creation.
  • Clean and isolated work & test environment.
  • Reduces the number of sandbox refreshes.
  • Ideal to test new Salesforce features.
  • Ideal for employee training.

Scratch Orgs in Copado DX

You can create scratch orgs in Copado DX for 5 main different reasons:

  1. Code and metadata development for developers and admins.
  2. To test a feature, a module or a release.
  3. To patch an older version of your application.
  4. As a training org or review application.
  5. As a stand-alone org for feature or preference investigations.

There are 3 different types of scratch orgs in Copado DX to fulfill the requirements developers or admins are assigned. 

  1. Scratch Org: This type of scratch org is flexible. Whenever a scratch org is created for a user story, a feature development or an investigation, Copado DX automatically assigns the Scratch Org type to the scratch org.
  2. Scratch Org - Test Only: As you can infer from its name, this type of scratch orgs can be used only for testing purposes. Therefore, this type of orgs cannot be part of any pipeline or any user story. You cannot commit any changes from this type of org either.
  3. Scratch Org - Patch: This type of scratch orgs can only be used as a patch org, therefore from these orgs developers cannot commit any new code or metadata, they can only work on existing metadata. By using patch orgs, developers can submit hotfixes for the current version of an app or a package. They can also do retroactive changes for an old version of an app or a package.

Creating a Scratch Org

  • Define what you want to achieve, in order to decide which Salesforce edition you need, which country and language you should select or in which pipeline you will include the scratch org.
  • In the pipeline, check the Enable Copado DX checkbox.
  • In the pipeline connection, select an org option from the Enable as Scratch Org Target picklist field in order to define this pipeline connection as DX target:

Copado DX offers you org definition templates from which developers and admins can benefit to overcome this troublesome situation.

An org definition template holds all the configurations, features and org preferences to be enabled for a scratch org. Release managers, project managers or system administrators can create these templates, and developers and admins can just select the template to create a scratch org.

Similarly to org definition templates, Copado DX also offers project templates, where a set of Git or unmanaged Salesforce packages can be stored for certain use cases such as app development, app or module testing, app or module training, etc.

For more details about templates please check out the article DX Planning Operations.

Once you have your templates ready, there are two pages from where you can create a scratch org, the Copado DX Panel page or the Scratch Org Wizard page on the user story. 

If you have not set up your templates yet, you can do so in the Scratch Org Definition section in the Copado DX Panel and the Scratch Org Wizard.

In the Copado DX Panel you can create scratch org from:

The Scratch Org Wizard is only available from the user story layout.

How did we do?