Navigation

Showing posts with label production. Show all posts
Showing posts with label production. Show all posts

Saturday, November 4, 2017

Deep Dive Into Negative Change Sets

"Shannon, I don't know what you just released to prod, but our CEO is calling me directly. Please fix it."

...

Ever wish you could just click a single button and undo a deployment? Well, you're in luck.

One of the topics I covered at Dreamforce with Norman Krishna during our "Where's the Undo Button" session was Negative Change Sets. 

Negative Change Sets are a declarative way to completely undo a release with a single button click. Why would you want to do this?

Let's say you deploy great items into production, but they somehow manage to negatively impact your users. Your immediate options are:

  1. Try to fix whatever you broke on the fly
  2. Revert back to a prior version of the functionality you created and remove the new functionality/items you deployed

As you can imagine, option #1 is super risky with no guarantee you'll be able to fix items. You'll also be in trouble with compliance if you're changing things directly in production, so you'll have to repeat the issue in a sandbox, fix it in the sandbox, and deploy your fix into production, which can take extra time.

With option #2, there is significantly less risk, but it may still take a while to revert because change sets take time to build and validate - especially if you have Apex in your org. You also need to make sure that anything touched in your deployment is reverted, which can be a time consuming and tedious task under pressure.

Enter Negative Change Sets. 

Instead of reverting in the moment, let's *plan* for our deployment to fail, and build our change sets before our deployment ever occurs. 

When you build and deploy a negative change set, you are reverting production back to the state it was in before your release. Ideally, your users will know no difference.

The idea is to build one or two change sets of the items that will undo your release, then quick deploy them if necessary. This means you won't have to scurry to fix things, then wait for the validation to occur. Planning to simply undo the release completely provides you more time to figure out what may have went wrong, and properly test any additional modifications in a sandbox.

Here are detailed instructions to build and deploy a negative change set. 


  1. Figure out what you intend to deploy to production in your next release. 
    • For our example, we intend to release a contact process builder change and an account page layout change, a new patient record object with several fields, and a new validation rule on opportunities
  2. Refresh a brand new, unused developer sandbox from production, call it "Negative Box" or something to denote this is where you will be building negative change sets
  3. Allow the new Negative Box sandbox to deploy changes to Production
  4. Create a brand new change set in Negative Box. Call it "Negative Box Revert" and add a release number or any other crucial details to the description to ensure everyone will know what this change set is -- a one-click undo button for the release.
  5. Add all Apex, Visualforce, Lightning Components, etc. to the Negative Box Revert change set
    • This ensures that if we make code changes during our next release, the code will be reverted back to a stable state, where we will achieve code coverage
    • If you have made code changes, check our Caveats section below.
  6. Add all of the existing items wherein you have changes or updates to the Negative Box Revert change set, which may include:
    • existing process builders
    • existing flows
    • existing workflow rules
    • existing fields
    • existing validation rules
    • existing approval processes
    • existing profiles
  7. For brand new functionality or objects, push them to Negative Box so you can use a change set from Negative Box to hide them with a single click
    • For our example, the brand new functionality and objects are the patient record object and our opportunity validation rule
    • We will bundle the patient record object and the opportunity validation rule into a change set, then deploy into Negative Box
  8. In Negative Box, remove brand new items from page layouts, modify the field level security to hide them, and remove permissions from profiles to revert - just like you would if you needed to hide/revert in production
    • For our example, we are hiding the patient record object from all profiles except System Administrator, and we are deactivating the new opportunity validation rule
  9. Bundle all new items into the Negative Box Revert change set. Include profiles, since you have likely hidden objects at the profile level as well.
    1. In our example, we include the opportunity validation rule and the patient record object, as well as all of our profiles
  10. Push the Negative Box Revert change set into production and validate
  11. Deploy the Negative Box Revert change set only as needed to revert.
Caveats:
  • Process Builders and Flows do not always automatically activate when updating or reverting an existing version. Ensure you check all versions to maintain the preferred active version.
  • For code changes, you should use the current Negative Box code versions to completely revert to existing production state. Then, bundle into the Negative Box Revert change set.
  • For brand new code, move the code into Negative Box but comment it out. Double check test classes to ensure they do not fail. Deactivate brand new triggers in Negative Box. Then, bundle into the Negative Box Revert change set.
  • If you have hidden new items or functionality during your Negative Change Set, you should return to the items or functionality in a patch release, OR completely delete them at a later date -- there is no need to keep broken, hidden items or functionality in your production instance

In conclusion, a little planning goes a long way. Let Negative Change Sets save your next deployment - before anything blows up. 

P.S. There are even cooler tricks to talk about regarding reversion. This post is meant for admins who are familiar with declarative functionality, but have never heard of source control. More to come, for sure!


Monday, October 30, 2017

Meet Norman Krishna, DevOps Architect

Norman Krishna
Dreamforce is just around the corner! It's my pleasure to introduce you to one of my Dreamforce co-presenters, Norman Krishna.

Norman has built release management from the ground up at small, medium, large, and super-sized organizations. Now, as a DevOps Architect, he is able to bring his meticulous organization and  delivery processes to every aspect of a project.

Norman and I worked on a large enterprise Service Cloud implementation last year. On the project, I was staffed as Technical Lead and Norman was the Release Manager.

During our time on the project, Norman and I had a lot of fun reviewing and exploring concepts of release management and deployment best practices. We spent a lot of time planning and building deployments, and worked through each release to refine our success criteria necessary for solid subsequent releases. Working through deployments with defined processes and common success criteria ensured every release succeeded, but we were always ready to execute a deployment rollback, if needed.

Given our experience together and his expertise on the topic, Norman was an obvious pick for co-presenter of "Where's the Undo Button? Deployment Best Practices" this year. In the event that you promote something to production that causes your users or stakeholders grief, three strategies we are sharing during our session will help you to restore production to a steady state.

Grumpy Cat doesn't know we have an undo button.
We hope that you can join us for the session and we will be sharing more information about deployments and release management in the coming weeks.

Learn more about Norman in the following digital interview.


Meet Norman Krishna: Digital Interview


How long have you worked in an IT-type function? 

For the past 9 years

What did your career journey look like? 

Have been in IT all my life -- starting from hardware Engineering support, software development, sales, general management, entrepreneur and now in Salesforce DevOps - it has been a great journey. What I love about my job is that it is constantly evolving. And Appirio has given me a great opportunity to work with a series of new enterprise clients (approximately one every year) and each of them are different in IT culture, infrastructure and processes.


What is your current role like? What does it entail? 

Currently, I am a DevOps Architect - primarily involves working with Dev teams to ensure that complex Salesforce applications are moved from development sandbox through qa, uat and finally production involving multiple IT teams and disciplines.

Do you have any advice for IT newbies/admins in the Salesforce space (in general)? 

Salesforce is a fantastic platform offering a diversity of experiences. You should have an open mind and be able to switch into multiple career options - Business Analyst, Developer, DevOps, Data Specialist, Integration specialist, Program/Project Manager. And remember - certification is also important. 

What is your favorite feature of the platform? 

As a DevOps, I love the wonderful metadata API that allows a multiple of deployment methodologies including rolling your own with the Tooling API

Favorite beverage? 

Spinach smoothie with kale and chia seeds.

What was your Salesforce certification journey like? How did you achieve your cert? Would you encourage others to attempt certifications? 

Actually, the best was my last one Software Development Life Cycle -- spent a couple of weeks reading through the reference material and passed the first time. Certification means more pay rises and most material is available online.

Did you have any mentors along your career journey? Who? How did you find them? 

Many of them - but Appirio has a wonderful mentoring process and I am fortunate to get a great mentor. And I also mentor others when needed.

Any books we should read or podcasts we should listen to? 

No one other than the legendary Jeff Douglas.


Any television shows or movies we should watch? 

Glen Garry Glen Ross - shows human emotions at it's best and worst - and also a great cast.

What was the silliest request you've ever fulfilled? 

No requests are silly -  what you need is to educate the requester.

What is the most common request you're happy to fulfill? 

Architect a Release from scratch.

Any AppExchange apps/Git repositories/other technological items worth a nod? 

Too many to list - but the best is Copado - a DevOps tool that nearly automates 99.99 of releases --expensive right now - but may become the market leader in future.