Change Sets in Salesforce are in essence a group of components that are to be deployed from one Salesforce org to another, typically from a sandbox to production (although it can be the other way around). The appeal of using change sets over other methods, such as deploying through Git, is the declarative nature of them.
Change Sets are built into Salesforce and are designed to be more user friendly allowing users aside from DevOps teams & developers to also utilise… you can access the Change Sets page from inside the Setup menu.
A quick note regarding Change Sets: Change Sets had their place, but are now superseded by the vast amount of version control & deployment technologies we have in the Salesforce Ecosystem now. Salesforce are releasing their own DevOps centre which cannot really be compared to Change Sets as the difference (and improvements) are quite vast. For more information, view this SalesforceBen blog post here.
Creating a Change Set
- From Setup, go to ‘Outbound Change Sets’ and press the first option,
- Click the ‘New’ button,
- Enter a meaningful name for the Change Set & hit Save,
- In the Components section, click the ‘Add’ button,
- Select the components you want to deploy and press the ‘Add to Change Set’ button,
- Press ‘View/Add Dependencies’ to see whether the components selected are dependent on other components, &
- If so, make sure you select the dependent components and press ‘Add to Change Set’.
Once the outbound section is done, we now need to authorise a ‘deployment connection’. To do this, log into the environment that you’re wanting to send these changes to and go to the Setup menu.
- Once here, type in ‘Deployment Settings’ and press the first option,
- Click ‘the Edit’ next to the org you’re wanting to receive the Change Set from, &
- Select ‘Allow Inbound Changes’ and press ‘Save’.
To send the changes to this environment, we need to go back into the environment where we created the Change Set…
- Go back into the ‘Outbound Change Sets’ in Setup,
- Find the newly created Change Set, &
- Click the ‘Upload’ button and then when ready, ‘Deploy’.
- If the deployment fails, for any reason, the whole deployment is rolled back,
- Once deployed successfully, the changes cannot be rolled back,
- You can only deploy changes made through the Setup menu,
- You can deploy unto 2,500 components at once.