Feb 11, 2013

Change Sets 101

Say you're a new Salesforce Admin and you need to make changes to your org.  You're already following best practices by making changes to your sandbox and not production (right?) and everything is working the way it should.  Now it's time to push those changes to production, but how?

Change Sets

The process is simple enough:

  1. Create an Outbound Change Set
  2. Add Components to that Change Set
  3. Upload the Change Set to another sandbox (you can do that) or production
  4. Validate and Deploy the Inbound Change Set in the org the Change Set was uploaded to

Before any of that can be done, you need to establish a Deployment Connection between your sandbox and your production instance which will allow you to upload Outbound Change Sets to Production for deployment.

NOTE:  You can establish Deployment Connections between two sandboxes as well for those times you need to push changes from one sandbox to another.  The rest of this post assumes you're pushing from a sandbox org to a production org.

Create Deployment Connection
  1. First, within your production instance, click on your name at the top of the page, and then click on "Setup"
    On the left-hand side, under "App Setup," expand "Deploy" and click on "Deployment Connections"

  2. Find the name of your sandbox and click on the "Edit" link next to it

  3. Check off the box that says "Allow Inbound Changes" and then click on the "Save" button

  4. The next thing to do is to create an Outbound Change Set within your sandbox. For this scenario, the change set will include a page layout that I want to deploy within my production instance as well as a new field that I added to the object within the sandbox. One change set, two components, one deployment. Nice!

Create Outbound Change Set
  1. Within your sandbox, click on your name at the top of the page again and then click on the "Setup" link
  2. On the left-hand side, navigate to "App Setup" --> "Deploy" and then click on "Outbound Change Sets"

  3. Click on the "New" button to create a new Outbound Change Set

  4. Provide a "Name" and "Description" for your change set.

  5. Click on the "Save" button.
  6. Within the "Change Set Components" section, click on the "Add" button.

  7. First, let's add the new field. Change the "Component Type" dropdown to "Custom Field"

  8. Next, find and select any fields that you also need to deploy that are not currently found in production.

  9. Click on the "Add to Change Set" button at the top of the page. Here's a quick tip -- make sure that you use the "Add To Change Set" button after you select something. Changing the component letter, page, or "Component Type" will clear any previous selections.

  10. Now it is time to do the same for the page layout. Change the "Component Type" to "Page Layout, find and select your new layout, and then click on "Add To Change Set" again.
Your change set should have two components in it now.

Upload a Change Set

1.  To push your Outbound Change Set to the Production instance for deployment, click on the "Upload" button.

2.  Choose your Production instance and then click on "Upload"

3.  Within a few minutes you should receive an email, letting you know that your Change Set was uploaded to the production instance. Keep in mind that you don't always have to push from a sandbox to production. You can go from sandbox to sandbox or even production to sandbox.

Validation and Deployment

Once you do receive that email, it is time to deploy it.
  1. Within the org you've uploaded your Change Set to, click on your name at the top of the page again and then click on the "Setup" link
  2. On the left-hand side, navigate to "App Setup" --> "Deploy" and then this time click on "Inbound Change Sets"

  3. Click on your change set. Here you will be able to see information about the change set, including its components, any details, and its deployment history. You also have two options; "Validate" and "Deploy."

  4. Clicking on "Validate" goes through all of the actions required to deploy the change set without actually deploying it. This is always a safer bet as you can learn which components will be new, overwritten, or deleted. Sometimes you learn things from a validation that you didn't expect and can save yourself from making mistakes. 
  5. "Deploy" first validates and if all is well will deploy your change set. Keep in mind that if you've added new layouts, they won't be assigned to a Record Type yet, so you'll have to do that manually. If you added fields, permissions won't be set up on that field as they would be if you were to manually create the field. The same goes for picklists options and their Record Type preferences.