How to Use Change Sets Effectively in Salesforce - Solution for Guru

Table of Contents
< All Topics
Print

How to Use Change Sets Effectively in Salesforce

📝 Summary

This article explains how to use Change Sets in Salesforce for deploying metadata components between connected orgs (typically from a sandbox to production). It also highlights tips, limitations, and best practices to ensure efficient and error-free deployments.


⚙️ What Is a Change Set?

A Change Set is a packaged bundle of metadata components (like Apex classes, objects, workflows, and layouts) used to move changes from one Salesforce org to another.


🔁 Deployment Flow Using Change Sets

  1. Develop and Test in a sandbox.
  2. Create an Outbound Change Set in the source org (e.g., Dev or QA sandbox).
  3. Upload the Change Set to the target org (e.g., UAT or Production).
  4. Deploy the Change Set from the target org using Inbound Change Sets.

🛠 Step-by-Step Guide

✅ Step 1: Create a Deployment Connection

  • Automatically created between Production and its sandboxes.
  • Verify in:
    Setup > Deployment Settings

✅ Step 2: Create an Outbound Change Set

  1. Go to Setup > Outbound Change Sets.
  2. Click New.
  3. Provide a name and description.
  4. Click Save.

✅ Step 3: Add Components

  1. In the Change Set, click Add under the “Change Set Components” section.
  2. Select the component type (e.g., Apex Class, Custom Object).
  3. Select one or more components.
  4. Click Add to Change Set.

📌 Tip: Use filters to quickly locate metadata.


✅ Step 4: Add Dependent Components

  • Click View/Add Dependencies.
  • Review and add any required dependent components (e.g., fields, permission sets).

✅ Step 5: Upload the Change Set

  1. Click Upload.
  2. Select the target org (must be connected).
  3. Confirm and upload.

✅ Step 6: Deploy from the Target Org

  1. Log in to the target org.
  2. Go to Setup > Inbound Change Sets.
  3. Locate and click on the received Change Set.
  4. Click Validate to simulate deployment.
  5. Click Deploy to apply the changes.

🎯 Best Practices for Using Change Sets

Best PracticeDescription
Use meaningful namesInclude ticket number, environment, and purpose in the Change Set name.
Add dependenciesUse the “View/Add Dependencies” button to avoid missing required components.
Validate before deployingPrevents issues during actual deployment.
Include test classesEnsure you deploy associated test classes for new or updated code.
Run all tests in productionRequired for Apex deployments; ensures system integrity.
Document the Change SetUse the description field to log changes or links to change tickets.
Clone when neededReuse and modify existing change sets for similar deployments.

⚠️ Limitations of Change Sets

LimitationDetail
Only works between connected orgsCan’t deploy between unrelated orgs or scratch orgs.
Not all metadata types are supportedFor example: Email Templates, Reports, Dashboards.
Manual processNo automation or version control integration.
No rollbackYou cannot undo a Change Set deployment automatically.
Cannot schedule deploymentsRequires manual action from the target org.

🧪 Troubleshooting Tips

IssueSolution
Missing componentsUse “View/Add Dependencies” or manually add missing metadata.
Deployment errorsReview error log, fix issues, re-upload.
Test failuresMake sure all test classes and dependencies are included.
Components not updatedDouble-check you’re uploading the latest version.

🏁 Summary

Change Sets are a simple and native way to deploy customizations between Salesforce orgs. By following best practices, understanding limitations, and validating changes, you can ensure smooth and successful deployments.