海角天涯社区

How to deploy metadata changes from sandbox to production in Salesforce

How to deploy metadata changes from sandbox to production in Salesforce

Holly White on

Share with



Deploying from a sandbox to production in Salesforce can be tricky. Not only does the Salesforce platform come with its own nuances, but custom objects and configurations add an extra layer of complexity. Whether you鈥檙e deploying natively with change sets or with a DevOps platform like 海角天涯社区, this post will show you what to look out for and walk you through how to deploy from your sandbox to your production org with ease.

What to watch out for when deploying from a sandbox to production

Teams can come up against a number of different issues when deploying metadata from a Salesforce sandbox to production. Sandboxes are a unique type of org 鈥� they鈥檙e designed to give ultimate flexibility in testing and are completely isolated from any of your other orgs. There are a number of best practices that apply to all deployments but there are a few additional things to keep in mind to help deploy successfully from a sandbox to production.

Type of sandbox

The type of sandbox you have can affect your deployment process. There are a few different types to choose from and all have their own characteristics and limitations:

  • A Developer sandbox is intended for development and testing in an isolated environment. These sandboxes only include a copy of your production org鈥檚 metadata and have a limited amount of file and data storage of 200MB.
  • A Developer Pro sandbox is similar to the Developer sandbox, but it can handle much larger data sets 鈥� with a storage capacity of 1GB.
  • A Partial Copy sandbox holds a copy of the metadata from your production org, as well as a limited subset of sample test data.
  • A Full Copy sandbox is an environment which provides a complete copy of your production org, including all data and metadata.

Understanding the differences and limitations of each sandbox type can help you make more informed decisions and avoid potential pitfalls during the deployment process. Regardless of the sandbox type, proper planning, version control, and thorough testing are all critical to achieve successful deployments.

Salesforce DevOps in the age of AI: is your custom pipeline ready?

Find out more

Sandbox management

Because your orgs are constantly changing, it can be tricky to keep your sandbox鈥檚 metadata closely synched to production. But if your environments don鈥檛 match up, you could introduce unexpected bugs and errors when deploying to production. To avoid this, it鈥檚 vital to keep your chosen sandbox as closely synced to your production org as possible by performing regular sandbox refreshes.

A sandbox refresh copies your production org, aligning the metadata (and data, depending on your sandbox) between your environments. This will give you a better idea of how changes will affect your live environment when they鈥檙e released and save you headaches when it comes to deployment time. Each sandbox type has a limit on how frequently you can refresh them, ranging from once a day to once every 29 days 鈥� but refreshing as often as possible is the best way to keep your environments as closely matched as possible.

Sandbox seeding is the process of populating your sandbox with test data, so you can test your changes before release. But it鈥檚 best practice to make sure no personal data from your production org makes it into your sandbox. Masking your data keeps sensitive production data safe while giving your team realistic data to carry out testing. This means they can release to production with the confidence that their features or changes will work.

Dependencies

The reason metadata can be tricky to deploy is because of the web of relationships and connections between components in your org. Forgetting to deploy these dependencies, or only selecting half, can cause huge headaches with failed deployments or complex error messages. These dependencies can be on anything from custom objects, Apex classes, triggers, and Visualforce pages and or even something as simple as a small permission setting. Deploying these components without considering their dependencies can cause deployment failures or your new changes to behave unexpectedly in production.

Apex code coverage

Salesforce has specific requirements for code coverage before any deployment to production, so if your deployment includes any Apex code you need to be cautious about code coverage and test classes. The minimum requirement is to have 75% of your Apex code covered by unit tests to be able to deploy to production environments. As well as this, all triggers need to have at least one line of test coverage.

API management

While API management is not directly tied to the specific process of deploying from sandbox to production in Salesforce, the API may indirectly influence areas of the deployment process. API versions are a key part of deploying successfully and without careful management the newer versions can cause confusion. You could start to see new differences in comparisons or experience a blockage when a validation or deployment fails. This is more of a risk when sandboxes are using a different platform version to your production org.

Difficult metadata types to deploy from a sandbox to production

Some metadata types are notoriously harder to deploy than others. We won鈥檛 list every single metadata type but here are some of the most common headache-inducers:

CPQ configuration

Salesforce CPQ deployments are well known for being difficult, with teams even trying to recreate configuration manually in the target org. Unlike other packages, CPQ configuration is stored as data, not metadata. That usually means you need a different tool and workflow to deploy CPQ than you use for metadata. If this sounds familiar, you can take the pain out of stressful CPQ deployments by using 海角天涯社区鈥檚 Salesforce CPQ deployment solution. Not only can you see all differences and dependencies clearly, but you can also deploy metadata and CPQ together in one deployment, not two.

Layouts

Deploying Page Layouts to Salesforce orgs can be so painful that many teams skip it all together. The biggest problem is that Layouts are large metadata items with lots of component parts, and most deployment tools only support deploying the Layout to Salesforce as a whole 鈥� in an 鈥榓ll or nothing鈥� approach. By using 海角天涯社区 for your deployments, you can easily deploy specific components of Layouts rather than the whole thing 鈥� saying goodbye to manual workarounds and overwriting teammates changes.

Flows

Deploying flows in Salesforce can be awkward for a number of reasons but the one we hear time and time again is an issue with versioning. Each time you make changes and save them, you create a new version of your Flow in that org. To confuse things, the version number depends on the target org. If you iterate on a Flow in a dev org and end up deploying v5 to a target that currently has v2, it will be added as v3. Using 海角天涯社区 helps you easily navigate these issues by helping you compare changes side-by-side, regardless of flow versions.

There are so many types of metadata and they all come with their own challenges. 海角天涯社区 helps take the pain out of these tricky metadata types, and hundreds more, including Digital experiences (communities), Profiles and permission sets and .

How to deploy changes from sandbox to production using change sets

Despite change sets being a slow and painful way to deploy, many teams are still using them every day. Let鈥檚 walk through how to do a sandbox to production deployment with change sets, and then look at the same deployment using Gearset.

To deploy to your production environment using change sets, the native Salesforce deployment tool, there are a number of steps to follow:

  • Log into your sandbox environment.
  • Under Environments in the side panel, select Change Sets > Outbound Change Sets > New.
  • Give your change set a name and description.
  • Under Change Set Components select Add.
  • Find and select the items you want to deploy using the check boxes.
  • Click Add to Change Set after selecting each metadata type.
  • When you鈥檝e included everything you want to deploy, click Upload to select the environment you want to deploy to and then click Upload again.
  • You鈥檒l receive an email saying the upload was successful, at which point you鈥檒l need to receive the inbound changes in your target org. Log into your production environment and select Environments > Change Sets > Inbound Change Sets. Your change set will be listed under Change Sets Awaiting Deployment.
  • Click Deploy, select a testing option then press Deploy again to start the migration.
  • Check your deployment status on the Deployment status page in Deployment settings.
Building an outbound change set in Salesforce

How to deploy changes from sandbox to production using 海角天涯社区

NOTE: 海角天涯社区鈥檚 comparisons have had an upgrade! We鈥檙e updating all our blog posts with the new UI images 鈥� but in the meantime, you can learn more about what鈥檚 changed.

If you鈥檙e looking for something more user-friendly where you don鈥檛 need to log in and out of your orgs for a single deployment, here鈥檚 how 海角天涯社区 makes it easy to deploy from your sandbox to production environment:

Select your source and target orgs

  • From the Compare and deploy page, select your source and target orgs 鈥� in this case, your sandbox as your source and your production org as your target.
Select your comparison orgs on 海角天涯社区鈥檚 compare and deploy landing page

Select a comparison filter

  • Select the relevant comparison filter or build your own before pressing Compare now.
Select a default comparison filter or build and save a custom filter

Choose the metadata you鈥檇 like to deploy

  • On the comparison screen, you鈥檒l see a side-by-side view of all the changes between your orgs. They鈥檙e separated into New, Changed or Deleted tabs for easier browsing. Choose the metadata items you want to deploy and click Next to finalise the deployment package.
Side-by-side view of all the changes between your orgs in Gearset

Run the problem analyzers

  • 海角天涯社区鈥檚 problem analyzers will pick up any dependencies that have been missed or flag any other issues that could cause the deployment to fail, as well as suggesting a fix. 海角天涯社区 will also run static code analysis on your deployment package, to highlight any violations. Once you鈥檙e happy, click through to the Pre-deployment summary.
海角天涯社区鈥檚 problem analyzers will pick up potential issues with your deployment package and suggest fixes

Deploy your changes

  • Give your deployment a friendly name and include any notes your team will find useful. You can also add and update any associated tickets from Jira, Azure DevOps Work Items or Asana for easy tracking and visibility. You can then choose to Validate deployment, Deploy now, or schedule the package to deploy at another time.
See a summary of all items to be deployed and associate any relevant tickets

Once the deployment has run, you鈥檒l be given a summary of the deployment and can download a full PDF report at any time from the Deployment history page.

Deployment successful

Deploying from a sandbox to production with change sets can be tricky at the best of times but especially if you鈥檙e migrating fiddly metadata types. Plus, if you run into errors, there鈥檚 no easy fix and you have to head back to your sandbox to rebuild and try again.

Thankfully, 海角天涯社区鈥檚 intuitive UI and problem analysers help you build and debug deployments in just a few clicks.

Supercharge your sandbox to production deployments

Whether you鈥檙e deploying from a sandbox to production, back promoting or rolling back a deployment, 海角天涯社区 can help! If you want further help speeding up your Salesforce deployements, catch up on this 30-minute webinar with DevOps Advocate Rob Cowell 鈥� he covers the 7 key deployment principles, including good preparation, using sandboxes, keeping orgs in sync, and improving visibility, that can help your team deploy faster and more reliably than ever.

Let 海角天涯社区 take the pain out of all your Salesforce deployments 鈥� sign up for your 30-day .

Ready to get started with 海角天涯社区?