Pages

Friday, June 1, 2012

Using Change Sets

A question came to me this morning from someone who had certain components built out in a a sandbox and needed them to be replicated in production. The components in this scenarios were page layouts; something easy enough to rebuild manually, but if you have dozens of fields, either of these methods would be faster.

  1. Eclipse
  2. Change Sets

They both require a few additional steps, but both prevent you from having to reproduce your work. Since we are dealing with page layouts, the first thing you need to make sure of is that all the fields referenced in the page layout exist within your production instance. You'll definitely receive error messages upon trying to deploy a layout to an object that is missing fields.

Using Change Sets

The Change Sets method will be easier for non-developers that don't know their way around Eclipse. This method will allow you to build Outbound Change Sets bu adding and removing components, and then uploading them to any allowed Deployment Connection. Let's start there by allowing establishing a Deployment Connection between your sandbox and your production instance which will allow you to upload Outbound Change Sets to Production for deployement.
  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.
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!
  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.
  11. Your change set should have two components in it now.
  12. To push your Outbound Change Set to the Production instance for deployment, click on the "Upload" button.
  13. Choose your Production instance and then click on "Upload"

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.
Once you do receive that email, it is time to deploy it.
  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 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 recordtype 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 recordtype preferences.