Deployment on production Environment in salesforce

When we move any code or component on 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 to send 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 sandbox and then enable checkbox for the Inbound change set and Outbound Change set

Enable Outbound checkbox for giving change set or Enable Inbound Change set for receive change set

After Enable 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 Change set.
Click on New Button for new Change Set

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

Write a Name or Description for create a change set

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

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

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

Click on 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 enable in production environment like this:

8. Now go to production and then select the outbound change Sets and Click Validate button.once the change set is validate 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 a automation Testing which is provided 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 shown error 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 be 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 test class or something else then error shows like this:

Found Error when Deployed the apex class and apex test class

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

Successfully Deployment on Production

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store