Set Up Your Sandboxes for Salesforce DevOps Center
In this blog, we discuss step by step how to set up your sandboxes for Salesforce DevOps Center.
Before you start work on a project in Salesforce DevOps Center, you define which environments you’ll use for the various release pipeline stages, including building, integration, UAT, and staging. You also set up the environments and add them to the project in DevOps Center.
Step 1: Define the Environments in Your Release Pipeline
Before setting up the orgs, define which ones you’ll need for each stage of the release process.
Salesforce requires that every team member who’s working on a part of the build has their own environment for the development stage. This can be a Developer Pro sandbox or Developer sandbox. You can also use a scratch org.
In DevOps Center, all work begins in environments with source tracking. These can be Developer Pro, Developer, or scratch orgs.
For integration, Salesforce recommends using a Full Copy, Partial Copy, or Developer Pro sandbox.
At the user acceptance testing stage, you should use a Full or Partial Copy sandbox.
It’s best practice to use a Full Copy for staging. If you don’t have one, you can use a Partial Copy.
As a rule of thumb, you should always start with the highest level org you have for that stage. If you don’t have the org Salesforce recommends, go down one level.
Step 2: Set Up Environments for DevOps Center
You need to set up your environments before you start a project in DevOps Center.
As you create each org, make a note of the relevant usernames and passwords. Be aware that the creation of an org can take anywhere from a couple of minutes to several days, depending on its type and size.
How to Create a Scratch Org
There are two ways to create a scratch org.
If you know how to code:
- Install the Salesforce DX plugin.
- Authorize Dev Hub.
- Create a scratch org shape or org definition file.
- Set up the DX project.
- Run the “Create” command.
If you’re a declarative user:
- Use an automated sandbox management tool.
- Click “Create Scratch Org.”
- Choose which org you want to base your metadata and data on.
- Click “Create.”
Developer Pro and Developer Sandbox:
- From Setup, enter “Sandboxes” in the Quick Find Box. Then select “Sandboxes.”
- Click “New Sandbox” and enter a name and description.
- Select the type of org you want.
- Click “Create.”
The problem with development environments is that although they contain source tracking and a copy of your production org’s metadata, they don’t come with any data. So you need to find a way to seed data to them, for example with automated sandbox seeding.
Partial Copy Sandbox
- Create a template to specify the data you want in this environment.
- From Setup, enter “Sandboxes” in the Quick Find Box. Then select “Sandboxes.”
- Click “New Sandbox” and enter a name and description.
- Select the type of org you want and click “Next.”
- Select the template.
- Click “Create.”
Full Copy Sandbox
- If desired, create a template to specify the data you want in this environment.
- From Setup, enter “Sandboxes” in the Quick Find Box. Then select “Sandboxes.”
- Click “New Sandbox” and enter a name and description.
- Select the type of org you want and click “Next.”
- If desired, select the template. Alternatively, if you want to include all the data in the sandbox, choose whether you want to include field tracking history data and how much, as well as whether you want to copy Chatter data.
- Click “Create.”
Step 3: Enable Source Tracking for Sandboxes
Because Salesforce DevOps Center provides source control, you need to enable Source Tracking for Sandboxes in all the orgs you’re going to use to create environments.
But what do you do if you want to use an existing environment that was created without enabling source tracking? Simply enable source tracking and refresh the org. Note that this setting is in your production org and will apply to any sandbox that’s created or refreshed after turning it on:
- In Setup, go to Dev Hub (available in Enterprise, Performance, and Unlimited Editions).
- Select “Enable Source Tracking in Developer and Developer Pro Sandboxes.”
- Refresh your sandboxes.
Step 4: Add team Member to the Right Environments
Add team members as users to the environments they need access to.
Step 5: Update the IP Allow List for DevOps Center App
Your security settings may require you to add the following IP addresses to the allow list:
52.43.33.118
44.230.180.227
44.225.154.211
100.21.209.24
Connecting to the DevOps Center
Now you have your environments set up, you’re ready to connect them to DevOps Center. Begin by creating a new project and connecting to GitHub.
Next, connect to the release environment, which is usually your production environment, and log in. Add the developer environments by selecting the appropriate sandboxes or scratch org, checking “Used for Development,” and logging in. Then add the rest of your pipeline environments and log in.
Note that you can add an environment at any time after you’ve created a project. However, to avoid complications, it’s best to define your pipeline ahead of time.
Development Environment Synchronization
With your pipeline set up, you can get to work. But when your team consists of multiple developers, it’s just a matter of time before your specific development environment gets out of sync with the source control system.
With DevOps Center, you can easily keep your development environments up to date with the latest source of truth.
DevOps Center provides an integration to a version control system. It tracks the differences between every org you’re using for development and the integration stage of the release pipeline. When DevOps Center recognizes that your org is out of sync with the source control system, it alerts you with a message: “Not in sync.”
You can click “What’s Different?” to see the discrepancies between your org and the source control system. Then you can opt to either sync only the changes that aren’t yet in your developer environment or sync all the metadata.
Thanks to the resulting synchronization process, you’re always developing against the most recent source of truth that includes modifications by other team members.
It’s essential to keep your development orgs in sync to avoid code conflicts, merge errors, and downstream release issues.
Sandbox Management is Critical to Salesforce DevOps Center
For a successful release process, you need to set up your sandboxes for Salesforce DevOps Center ahead of time and keep them in sync throughout development. By understanding how to leverage sandbox management to your advantage, you can maximize your ROI from DevOps Center.