SF Learners Hub

MASTER SALESFORCE, CONQUER YOUR GOALS

How to do Deployment on production Environment in salesforce

Share This Post

When we move any code or component to the production environment we need to keep the below terms for our understanding:

These terms are-:

  1. Change Set: change sets are used to send customizations from one Salesforce org to another. Salesforce Change Sets are the mechanism by which changes from one Salesforce environment can be pushed into another Salesforce environment. Salesforce change set best practices means you’ll need to move changes out of an environment. You must first create an Outbound Change Set and point it towards a receiving environment.
  2. Inbound Change Set: An inbound change set in Salesforce is a change set that has been sent from another Salesforce org (Sandbox environment) to the org(production environment) you are logged in to. A change set must be deployed for the changes to take effect.
  3. Outbound Change Set: An outbound change set in Salesforce is a change set created in the Sandbox environment in which you are logged in and sent to the production environment.
Process of Change set
  • Steps to use Change Sets in Salesforce

Find Deploy in Quick Find box -> Deployment Setting -> click Edit one of the sandboxes and then enable the checkbox for the Inbound change set and Outbound Changeset

Enable Outbound checkbox & Inbound Change Checkbox

After Enabling the checkbox please click on Save.

Follow these steps to give Outbound Change set from Sandbox org to Production Environment -:

  1. Setup -> search change set in quick find box -> click Outbound Changeset.
Click on the New Button for the new Change Set

2. Click on the New Button. Enter the changeset Name, and Description and click the ‘Save’ Button.

Write a Name or Description to create a change set

3. Add ‘Change Set Components’ like Apex classes, Objects, Tabs, Validation Rule, Aura Components, and Trigger… and Click on the Add button.

Click to Add Button to add a component
Click on to Add To Change Set Button

4. After adding the components to the change set click on Upload Button.

Click on the Upload Button

5. After clicking on Upload Button please select a Production Environment like this:

Select the Production Environment Checkbox

6. After Select Production Environment click on the Upload Button. Then the change set is successfully uploaded to the Production Environment.

7. Ensure that the Allow Inbound change should be enabled in a production environment like this:

8. Now go to production and then select the outbound change Sets and Click the Validate button. Once the change set is validated then further proceed for the Deployment.

Change Set Validate on Production
Change Set Deploy on Production

Test class in Salesforce:

Testing is an important part of SDLC. Salesforce requires at least 75% of your code to be covered by our test classes. Salesforce has done that to make sure that our code doesn’t break in any situation in Production.

It is an automation Testing that is provided by Salesforce by Default. when you write all the test cases in the test class then it will automatically test all the test cases.

when test cases are not covered in the given test class, then it will show errors like these which are described below:

Note:

  1. If you are giving the apex class or apex test class then ensure that the code coverage of the test class is 75% or more than 75%. If code coverage of the apex class is not accurate then you will face this error like that:
Code Coverage Error

2. In your Apex class there is found any error like duplicate Function, Name, Email, or Expected or Actual Answer in the test class or something else then the error shows like this:

Found an Error when Deploying the apex class and apex test class

3. If no error when validating your change set on production that means Change Set is Successfully validated and after that can start the deployment like that:

Successfully Deployment on Production

Please Refer to this Module for more read about the Change set:

https://trailhead.salesforce.com/en/content/learn/modules/declarative-change-set-development

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

The Power of Salesforce Integration

What You’ll Learn What Is Salesforce Integration? Salesforce integration involves combining the data and features of Salesforce with another application, creating a cohesive experience for