Learn how to simplify the process of performing destructive changes in Salesforce, making it easier and safer to remove unused Apex Classes and other metadata types automatically.
In this article, we'll guide you through the process of performing destructive changes in Salesforce with the help of Blue Canvas, shedding light on the challenges of removing unnecessary code and how to overcome them. You'll learn how Blue Canvas enables the automatic generation and deployment of destructive changes, and the safety net it provides in terms of code backup.
Here are our 5 key takeaways:
Many Salesforce organizations have accumulated unused code over the years, which can affect both application performance and developer workflow speed. Regularly removing unused code is beneficial but can be challenging due to Salesforce's limitations on making destructive changes. Tools like Ant and XML scripting can be used for removing code, but they require specific domain knowledge and are not always reliable. Deleting fields through a destructiveChanges.xml script is irreversible, which can make the process risky and lead to hesitation in removing old code due to potential dependency issues. Utilizing tools that track all changes and provide backups for everything deleted can boost confidence in cleaning up old fields and types, ensuring a safety net in case of regrettable deletions đź‘Ś FREE TOOL
Profiles & Permissions Deployer
Easily compare and deploy Profiles, Permission Sets, and Field-Level Security (FLS) between any two Salesforce organizations.
Get Started
Made with love by the Blue Canvas team ❤️
The Need for Destructive Changes in Salesforce Are there fields or metadata components in your Salesforce orgs that you no longer need? Is all of your code being used by your end-users? For many the answer is “probably not”. After years on the Salesforce platform, many organizations have seen the build up of unused code on their Salesforce orgs and are working to clean things up. Having unused code in your application is a real cost from a performance and developer workflow perspective. Unused code will slow you down in both the speed of your application and the speed of your developers in their ability to improve the application. Regularly cleaning up unused code is a good thing to do.
The Challenges in Implementing Destructive Changes Unfortunately, Salesforce does not make it very easy to remove code. Destructive changes in Salesforce are just a pain.
The Limitations of Salesforce You can’t make destructive changes with Change Sets. You have to use the Force.com migration tool . That requires some specific domain knowledge and the setup and maintenance costs associated with running the Ant migration tool. And even if you are an expert with Ant and XML scripting, the tool isn’t always reliable for destructive changes.
Introducing Blue Canvas for Destructive Changes Blue Canvas allows you to do destructive changes easily. Simply compare to branches. Items that are red will be deleted.
Blue Canvas then generates the destructiveChanges.xml and deploys the destructive change automatically.
.ap3w-embeddable-form-6491c5ce2060226781d5c909{box-sizing:content-box;width:100%;font-size:16px;max-width:850px;max-height:100%;overflow:auto;background-color:#f4f6fb;border:2px solid transparent;box-shadow:0 0 10px 3px rgba(0,0,0,0);z-index:unset}.ap3w-embeddable-form-6491c5ce2060226781d5c909:before{content:' ';display:block;position:absolute;pointer-events:none;left:0;top:0;width:100%;height:100%;opacity:0%;background-image:url();background-position:center center;background-size:cover;background-repeat:no-repeat}.ap3w-embeddable-form-content{margin:auto;padding:32px}.ap3w-embeddable-form-6491c5ce2060226781d5c909-rounded{border-radius:12px}.ap3w-embeddable-form-6491c5ce2060226781d5c909 .ap3w-text{margin-bottom:16px}.ap3w-embeddable-form-6491c5ce2060226781d5c909 .ap3w-text *{padding-bottom:5px}.ap3w-text-6491c5ce2060226781d5c909{position:relative;margin:0;margin-bottom:16px;word-wrap:break-word}.ap3w-text-6491c5ce2060226781d5c909 *{margin:0;padding-bottom:8px}.ap3w-text-6491c5ce2060226781d5c909 p{text-transform:unset;text-decoration:unset;text-indent:unset}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h1"]{font-family:Hind,Helvetica;font-size:30px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h2"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h3"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h4"]{font-family:Hind,Helvetica;font-size:16px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h5"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h6"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p{font-family:Hind,Helvetica;font-size:16px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="large"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="small"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909{position:relative;margin:0;margin-bottom:16px;word-wrap:break-word}.ap3w-text-6491c5ce2060226781d5c909 *{margin:0;padding-bottom:8px}.ap3w-text-6491c5ce2060226781d5c909 p{text-transform:unset;text-decoration:unset;text-indent:unset}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h1"]{font-family:Hind,Helvetica;font-size:30px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h2"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h3"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h4"]{font-family:Hind,Helvetica;font-size:16px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h5"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="h6"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#433efe;font-weight:700;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p{font-family:Hind,Helvetica;font-size:16px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="large"]{font-family:Hind,Helvetica;font-size:20px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-text-6491c5ce2060226781d5c909 p[data-size="small"]{font-family:Hind,Helvetica;font-size:14px;line-height:1.2;color:#333333;font-weight:400;font-style:normal}.ap3w-form-input-6491c5ce2060226781d5c909{position:relative;margin-bottom:20px}.ap3w-form-input-6491c5ce2060226781d5c909 input{margin-top:8px;box-sizing:border-box;width:100%;background-color:#FFFFFF;border:1px solid #000000;color:#000000;outline:none;font-family:Hind,Helvetica;font-weight:400;font-style:normal;font-size:16px;line-height:1.2;padding:10px 16px;resize:none;border-radius:4px}.ap3w-form-input-6491c5ce2060226781d5c909 .ap3w-form-input-label{font-weight:bold;color:#000000;font-family:Hind,Helvetica;font-size:16px;line-height:1.2}.ap3w-form-button-6491c5ce2060226781d5c909 button{position:relative;cursor:pointer;padding:10px;font-weight:bold;outline:none;border:2px solid transparent;color:#ffffff;background-color:#01b272;font-family:Hind,Helvetica;font-size:16px;line-height:1.2;border-radius:4px;flex:1}
The Risks of Deleting Fields in Salesforce Generally, when you run a destructiveChanges.xml script and delete fields, you cannot undo what you have done. Deletions are permanent. This can make deleting fields a bit scary and it’s a big part of why teams are so hesitant to do it. And this is why we see so many massive Salesforce projects with code from 8 or 9 years ago that no one is willing to delete because they don’t have the confidence to know that what they are deleting won’t cause dependency issues with their more recent code.
How Blue Canvas Provides a Safety Net for Destructive Changes With Blue Canvas all changes are automatically version controlled , nothing is permanently deleted. You always have a backup of everything that you add, modify or delete in you Salesforce orgs . This gives you the confidence to delete old fields and types without worrying about never being able to restore them again.
Sign up for free now or get in touch with us to learn more about what Blue Canvas can do for your DevOps needs.
‍
--------
FAQs What are destructive changes in Salesforce?
Destructive changes in Salesforce involve removing unused code such as Apex Classes and other metadata types that are no longer needed. This is typically done to improve application performance and developer workflow speed. Why is it important to remove unused code in Salesforce?
Unused code can slow down both the speed of your application and the speed of developers' ability to improve the application. Regularly removing unused code improves application performance and developer workflow speed. Why is it challenging to make destructive changes in Salesforce?
Salesforce does not provide an easy way to make destructive changes. This process often requires specific domain knowledge, such as using tools like the Force.com migration tool, Ant, and XML scripting, which can be complex and are not always reliable. What is the role of Blue Canvas in making destructive changes in Salesforce?
Blue Canvas simplifies the process of making destructive changes in Salesforce. It enables easy comparison between branches, marking items to be deleted in red. It then automatically generates the destructiveChanges.xml and deploys the destructive changes. What is the risk associated with deleting fields through a destructiveChanges.xml script in Salesforce?
Deleting fields through a destructiveChanges.xml script is irreversible. This makes the process risky as it can potentially lead to issues due to dependencies with more recent code. How does Blue Canvas provide a safety net for making destructive changes?
Blue Canvas tracks all changes in Git, ensuring nothing is permanently deleted. It provides a backup for everything that is deleted in Salesforce orgs, giving users the confidence to delete old fields and types without worrying about restoration issues. How can I start making destructive changes with Blue Canvas?
You can start by using Blue Canvas to compare branches and mark items to be deleted. Blue Canvas will then automatically handle the rest by generating and deploying the destructive changes. Try bluecanvas now!
Start your 14-day trial!
Get Started
Made with love by the Blue Canvas team ❤️