Deployments by using change sets
By using change sets we can deploy our customizations from one environment to other environments in Salesforce.
Change sets available in Enterprise, performance, unlimited and Database.com editions.
Note: In this post organization/environment means it may be sandbox or production. By using change sets we can deploy code from sandbox to sandbox and also we can deploy Sandbox to production.
Prerequisites to deploy by using change sets
1. A deployment connection between two organizations.
2. Overall test class code coverage should be greater than 75%.
3. Create and upload change sets user permission to create or upload change sets.
How to do deployments by using change sets?
1. Create outbound change set in source organization and upload that change set to Target instance.
2. In target instance go to inbound change set and go to the change set uploaded from source instance and deploy that change set.
For example you have done with your customizations in Developer sandbox. You are trying to deploy your changes from Development environment to TEST/PRODUCTION. In this case first create connection between DEVELPOPMENT Sandbox to TEST/PRODUCTION
Once connection is established go to outbound change set and create one outbound change set in DEVELOPMENT sandbox and add list of components to that outbound change set. Next upload that change set to TEST/PRODUCTION. Next in your target instance go to inbound change set in TEST/PRODUCTION and deploy that change set.
What is inbound change set and outbound change set?
Outbound change set: An out bound change set is a change set created in Source organization and that you want to deploy to target organization.
Sending an outbound change set to another organization doesn’t guarantee that the changes will be implemented in that organization. The change set must be deployed (accepted) by the target organization before the changes take effect.
Inbound change set: An inbound change set is change set that is sent from source organization to the target organization. A change sent must be deployed for the changes to take effect. You can deploy the contents of an inbound change set as a whole, but not on a component-by-component basis.
To deploy your changes by using change set follow below steps
1. Set up -> Deploy -> click on “Outbound change sets”, you will navigate to following screen.
Click on new button and provide required details name and description and click on save.
2. After saving you will navigate to following change set detail page. No you have to add your components to change set.
Click on “add” button (which is marked in yellow color in above screen) to add components to your change set.
3. After adding all components to change set, click upload button to upload this change set to target organization. See the following image for reference.
Make sure that you have already established connection between source and target instance. If you are not established connection between source and target, follow the below steps to create connection.
Go to setup-> deployment connections -> select you target and click on edit -> and check the “Allow inbound change set” and click on save.
4. After uploading the change set go to your target organization and click on inbound change sets and click on the change set uploaded by you. See the below image for reference.
5. Next click on Deploy button to deploy your changes.
If you aren’t ready to deploy at this time, you can click Validate to preview deployment results without committing any changes. It isn’t necessary to validate before deploying, as the deployment won’t commit any changes if there are failures.
6. After the deployment you can see the status value with Deployed. And you can view the results. See the below image for reference.
If there are any failures you will get Status with Failure value and you can see error messages in View Results.
Note: By using change sets you can deploy 2500 components at a time.