Scratch Orgs

Updated 1 month ago by Mert YALTI

Scratch Orgs

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.

      Salesforce-

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 features of Salesforce
  • Ideal for employee training

In CopadoDX scratch orgs can be created for 5 main different reasons:

  1. Code and Metadata development for Developers and Admins
  2. A feature, module or a release testing
  3. To patch an older version of your application
  4. As training org or review application
  5. As stand-alone org for feature or preference investigations


In CopadoDX, scratch orgs has 3 different types to fulfill the requirements that developers or admins are assigned. 

  1. Scratch Org: This type is a flexible type. Whenever a scratch org created for a user story, for a feature development or for investigation CopadoDX will automatically assign scratch org type as "Scratch Org".
  2. Scratch Org - Test Only: As it is understood from its name this type of scratch orgs can be used only for testing purposes, therefore, this type of orgs cannot be a part of any deployment flow or any user story. They cannot be used to commit any changes from.
  3. Scratch Org - Patch: This type of Scratch orgs can only be used as a patch org so 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 an artifact also they can do retroactive changes for an old version of an app or an artifact.

Creating a Scratch Org

In order to create a scratch org, you need to define what you want to achieve. With that definition, you can easily decide which Salesforce edition you need, which country and language you should select or which deployment flow you will include the scratch org but to enable Salesforce features you need or which org preferences you need to enable or disable you need deep knowledge and understanding on those features and preferences. 

CopadoDX offers org definition templates which developers and admins 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 manager or system administrators can create these templates and developers and admins can just select the template to create a scratch org.

Similar to org definition templates, CopadoDX also offers project template where a set of Git or Unmanaged Package artifact can be stored for certain use cases. Such as App development, app or module testing, app or module training etc.

For more details about template please check CopadoDX Planning Operations
 

When you have your templates ready, there are two pages to create a scratch org from "CopadoDX Panel" or from user story "Scratch Org Wizard". 

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

Note: Scratch Org Wizard is only available from user story layout.


How did we do?