The Nightmare Scenario
You’ve just put the final touches on a new feature and finished adding a final Apex trigger. It’s not a major feature – but it’s taken you two weeks to finish it and you can’t wait to deploy it to your users this afternoon. You click save in Salesforce and then head out for a celebratory lunch. When you return and start preparing a change set, you notice something odd. You don’t see any of the work you have been doing for the past 2 weeks. You imagine it must be your postprandial haze and you go to your coworker to get a second pair of eyes on it.
“Oh, I just refreshed that sandbox,” they say. A mild panic sets in as you realize that all of your work is lost forever and that it will have to be painstakingly redone.
This nightmare scenario happens all too frequently in Salesforce. People refresh sandboxes. People deploy from one sandbox to another. People log in to production and make changes that clobber existing work. There are simply too many ways for your metadata to be overwritten or permanently deleted.
The Cost of Not Backing Up Metadata Can Be High
The scenario described above is actually a fairly benign example. Imagine you have a whole team of developers and admins working on new functionality for several months. Losing work would amount to tens of thousands of dollars of development time thrown down the drain. 2012 Salesforce MVP Matt Botos wrote a harrowing post about a potential loss of $36,000 in custom development that he averted by backing up metadata.
Using these average Salesforce salaries as a baseline we can quickly calculate the cost. A Salesforce developer makes on average $87,000/year and an admin makes $64,000/year (that does not include benefits). Let’s say you have a small team of 3 developers and 1 admin. On a weekly basis that’s over $6,700/week. Even losing a month of is over $13,500 at that rate (and it doesn’t include benefits or opportunity cost of the lost time). Sadly, we’ve heard of teams with ten or twenty developer losing months of work. It’s not a good situation.
Backing up metadata regularly is quickly becoming a best practice in Salesforce, though far too few teams are doing it thoroughly. Backing up Apex code is a good start, but it’s important to make sure that all of your custom metadata – including declarative changes – are tracked and backed up.
A good Salesforce source control solution solves this problem by continuously backing up your Salesforce metadata so that you know that your team’s hard work is never going to be capriciously deleted. This small investment can save you thousands of dollars and a tremendous amount of headache.
A good source control solution also gives you more insight into how your Salesforce development process is going. With source control and metadata backups, you can actually start to see who is making what changes and when. This makes debugging and troubleshooting much simper. For example, if you are seeing errors starting at 2pm, it’s useful to know that Joe Smith updated a related field and class at 1:59pm.
Having this kind of information is also incredibly useful for compliance reasons. As teams start to implement things like Sox compliance, having a source of truth for changes in your Salesforce code is a must.
Most importantly, a good metadata backup solution facilitates better collaboration among your team. Not only will you be able to prevent team members from overwriting each other’s work, you can increase productivity and code quality by implementing the best practice of code reviews. And with proper source control you can finally implement proper continuous integration for Salesforce and be ready for Salesforce DX.
Setting up source control is much easier than it was a few years ago. Now that tools like GitHub and Atlassian’s Bitbucket exist, you can put your Salesforce code into Git without having to host your own Git repository. You can use the Ant migration tool to write scripts that bring your Salesforce code into source control and push them to GitHub or Bitbucket.
If you are not interested in setting up and maintaining your own scripts to run Salesforce metadata backups, you can use automatic backup services for Salesforce like Blue Canvas. Backing up metadata is a small investment that can save your team tens of thousands of dollars and help you sleep better at night.