A step-by-step guide to Salesforce scratch org management
Salesforce scratch org management is a process of the Salesforce platform that allows developers to create and manage isolated Salesforce environments, called scratch orgs, for development and testing purposes.
Harald is the Co-Founder of Hutte, bringing his vision of no-code DevOps to life. His passion enables teams and individuals to focus on what matters most – bringing value to the users they build for.
Samantha Spiro
Senior Content Manager & Editor-In-Chief
Samantha is Hutte's Content Manager and Chief Editor. She has over six years of experience as both a content writer and a copywriter. Bringing the written word to life is the name of her game.
Article highlights
The article discusses how product managers can use Salesforce DX (SFDX) to collaborate with developers, understand the development process, manage customizations, test new features, automate tasks, and package applications.
It outlines the limitations and challenges of using SFDX, such as the need for technical expertise, additional development work, deployment challenges, version control management, and ensuring security and compliance.
Hutte is presented as a user-friendly tool that simplifies working with SFDX for product managers, offering a web-based interface for Salesforce version control, easy management of scratch orgs and sandboxes, and integration with Git hosting tools without the need to learn Git.
They are temporary, disposable environments that can be created on demand and customized to match a development project's specific needs.
🐛
Without affecting other team members, developers can create multiple scratch orgs for different development tasks, such as testing new features or fixing bugs.
In the past, Salesforce development was typically carried out in sandboxes. Changes were moved using change sets or other metadata deployment tools.
Salesforce has however introduced a new development model, which includes scratch orgs. Some users are thus unsure about if they should be doing their development work in a sandbox or a scratch org.
Knowing the differences between them is crucial to determining which one should be used.
Scratch orgs
Sandboxes
They are erased after seven days.
They only erase when it refreshes.
They have no data or metadata.
They contain different levels of data and metadata.
They are a blank org.
They come from a ‘source org’ with some of its data.
Scratch orgs are typically managed using command-line Interface (CLI) commands and metadata configuration files. SFDX enforces continuous integration, delivery, and version control.
Here are the main steps involved in managing scratch orgs:
Create a scratch org
Using the CLI, you can create a new scratch org and configure it with specific settings, features, and data.
Develop in the scratch org
Once the scratch org is created, you can use it to develop your Salesforce code,creating or modifying objects, fields, workflows, and other metadata.
Push metadata to the scratch org
After making changes to your local codebase, you can use the CLI to push the changes to the scratch org. This ensures that the scratch org reflects the latest changes.
Test and validate changes
Once the changes are pushed to the scratch org, you can test and validate them by running automated tests, manual tests, or other validation methods.
Create a new scratch org
Once the scratch org has served its purpose, you can delete it and create a new one. This allows you to start fresh and ensures you always work in a clean development environment.
In essence, managing scratch orgs from the command line is like playing Tetris with command-line blocks; it's fun but can get messy quickly. With that being said, managing Salesforce scratch orgs can present several challenges:
Managing scratch orgs using the CLI requires a good understanding of Salesforce CLI commands and metadata configuration files, which can be challenging for new users.
Setting up and configuring scratch orgs using the CLI can be time-consuming, especially when working on complex Salesforce projects requiring multiple scratch orgs. For some products, it may take hours for a scratch org to spin up. This means that development is halted during this waiting period.
Configuring scratch orgs using the CLI is a manual process requiring users to enter commands and make configuration changes manually. This can be prone to errors and make it challenging to ensure that all scratch orgs are set up consistently.
Managing scratch orgs using the CLI can be challenging, as it can be difficult to track which changes have been made to which orgs.
However, what if there's a better way to manage your scratch orgs?
🚧
It's a way that feels more like playing Jenga than Tetris, where you can build up and tear down environments with ease.
With Hutte, a web UI to SFDX that enables visual Salesforce version control, Salesforce scratch org management becomes a labor-saving development workflow.
Hutte enables developers to easily create, modify, and delete scratch orgs as needed.
Hutte is truly one of the best tools that we use. Product owners, Salesforce solution architects, business analysts — anyone on our team can easily and visually accomplish the tasks that would otherwise take a lot of clicks, time, and coding.
Create scratch orgs in a collaboration-friendly environment
You can create scratch orgs that can be accessed together as a team. Users can create scratch orgs using the “New scratch org” button.
You can choose a Git branch from which you want to create your environment and name it.
🤝
Your scratch orgs will be listed in one place, giving you a historical overview or snapshot of your projects, apps, and codebases created in Git. This is a helpful feature, as you and your team ultimately want to contribute to each other’s work.
Without Hutte, you need to rely solely on CLI. With Hutte, you can:
Easily make changes to the latest state of your source
Implement the new feature
Ship it to Git
It will get integrated with Hutte.
If a developer has executed new features and submitted it to Git, instead of them manually having to tell the team that they have provisioned an environment, the team can simply view it on the scratch orgs dashboard.
They will tell the team which branch they added the features to. You can then find the branches by “New scratch orgs.” From there, you can create a scratch org from that branch. It will appear in your list of scratch orgs.
You won’t need to run the code locally
It won’t block your machine, and it won’t block you
It will run asynchronously on Hutte’s infrastructure.
☝️
When your scratch org is ready, you won’t have to worry about user creation or any manual steps to build the org. Once you have logged into the scratch org, you can play around with it without affecting other users’ data.
Hutte essentially empowers users to manage and pick their own environments easily.
Pick a scratch org from the pool
Hutte has a pool of orgs pre-created for you, so you don't need to wait, as you can spin them up visually. Picking a scratch org from the pool speeds up the process even further when you need an environment from the latest state of your source.
You can “Take from pool,” enter the name of the pool you want to claim, and it will appear in your pool.
You can dimensionate your pool by going to “Settings.” You can also decide its size and length.
Hutte offers easier sandboxes
Without Hutte, you need to follow these steps for sandboxes:
Install the necessary CLI tools
Create a new sandbox
Configure the sandbox
Use the sandbox
Clean up the sandbox.
🤯
With Hutte, you can visually access the latest sandboxes in your org without CLI or coding knowledge. You can also create your own sandboxes. You will soon be able to refresh sandboxes and bring them up to date with the latest code.
There is also a “Features” tab that enables collaboration on changes within sandboxes, such as with scratch orgs.
Hutte’s Jira plugin
If you use Jira, there will be a work item for it. Hutte’s Jira plugin will then find scratch orgs that reference the same name as your work item (or issue).
As a product manager, you can then leave a comment for the developer who worked on the scratch org you selected. This enables collaboration without any interference or overriding of work already done by a developer.
This plugin is still very new, so watch this space for more updates.
Scratch org management made easy
Even though scratch orgs are intended to be workspaces where individuals can explore and test features in isolation, when you work together, you can conquer challenges. Obstacles like configuration management, data management, andjuggling multiple scratch orgs become more streamlined.
💡
Teaming up helps you share code, manage dependencies, and optimize your workflows for maximum productivity and efficiency.
So, consider utilizing Hutte, work together, and watch your Salesforce development efforts skyrocket with better outcomes and top-notch code quality.
Harald is the Co-Founder of Hutte, bringing his vision of no-code DevOps to life. His passion enables teams and individuals to focus on what matters most – bringing value to the users they build for.
Samantha is Hutte's Content Manager and Chief Editor. She has over six years of experience as both a content writer and a copywriter. Bringing the written word to life is the name of her game.