Deploying Apex code, along with other customizations, to your Salesforce production organization is a critical step in the development lifecycle. A common and straightforward method for achieving this is by using Change Sets.
Change sets allow you to package components (like Apex classes, triggers, Visualforce pages, custom fields, etc.) from one Salesforce organization (typically a sandbox) and deploy them to another (like production). The final step in this process involves deploying the inbound change set in the target production organization.
Deploying an Inbound Change Set to Production
Once you have successfully created an outbound change set in your source organization (e.g., a sandbox), added your Apex code and other necessary components, uploaded it, and it appears in the list of inbound change sets in your production organization, you can initiate the deployment.
Here are the exact steps to deploy the change set containing your Apex code to production:
- Navigate to Setup: In your production organization, click the gear icon (⚙️) at the top right and select Setup.
- Find Inbound Change Sets: In the Quick Find box on the left sidebar, type
Inbound Change Sets
. - Select Inbound Change Sets: From the filtered results, click Inbound Change Sets.
- Continue (if needed): If a splash page or introductory screen appears, click Continue.
- Locate Your Change Set: You will see a list of change sets awaiting deployment or already deployed. Find your change set's name in the Change Sets Awaiting Deployment list.
- Click the Change Set Name: Click on the name of your specific change set to view its details.
- Initiate Deployment: On the change set details page, click the Deploy button.
Deployment Status and Monitoring
After clicking Deploy, Salesforce will start the deployment process. The status of the deployment will appear on the change set details page. You can monitor the progress and view any success or failure messages. It's important to note that deployments typically require successful execution of all Apex tests and sufficient code coverage (currently 75% overall code coverage across your production org) for the deployment to succeed.
Key Deployment Steps
Here is a summary of the final deployment steps using the Inbound Change Set interface:
Step | Action |
---|---|
1. Access Setup | Click ⚙️ > Setup in production. |
2. Find Inbound Change Sets | Use Quick Find for Inbound Change Sets . |
3. Select Inbound Change Sets | Click the Inbound Change Sets link. |
4. Continue | Click Continue on the splash page (if shown). |
5. Locate Change Set | Find your change set under Change Sets Awaiting Deployment. |
6. Click Change Set Name | Click the name of your change set. |
7. Deploy | Click the Deploy button on the change set details page. |
Successfully completing these steps will deploy the components included in your change set, including your Apex code, into your Salesforce production environment.