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:
- Code and metadata development for developers and admins.
- To test a feature, a module or a release.
- To patch an older version of your application.
- As a training org or review application.
- 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.
- 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 will automatically assign the scratch org's scratch org type.
- 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.
- 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 an artifact. They can also do retroactive changes for an old version of an app or an artifact.
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 package artifacts 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 user story's Scratch Org Wizard page.
In the Copado DX Panel you can create scratch org from: