Wednesday, December 21, 2022

Apex - Deployment

What is Deployment in SFDC?

Till now we have developed code in Developer Edition, but in real life scenario, you have to do this development in Sandbox and then you might need to deploy this to another sandbox or production environment and this is called the deployment. In short, this is the movement of metadata from one organization to another. The reason behind this is that you cannot develop Apex in your Salesforce production organization. Live users accessing the system while you are developing can destabilize your data or corrupt your application.

Tools available for deployment −

  • Force.com IDE
  • Change Sets
  • SOAP API
  • Force.com Migration Tool

As we are using the Developer Edition for our development and learning purpose, we cannot use the Change Set or other tools which need the SFDC enterprise or other paid edition. Hence, we will be elaborating the Force.com IDE deployment method in this tutorial.

Force.com Eclipse IDE

Step 1 − Open Eclipse and open the class trigger that needs to be deployed.

Eclipse Process Step1

Step 2 − Once you click on 'Deploy to server', then enter the username and password of the organization wherein, the Component needs to be deployed.

Eclipse Process Step2

By performing the above mentioned steps, your Apex components will be deployed to the target organization.

Deployment using Change Set

You can deploy Validation rules, workflow rules, Apex classes and Trigger from one organization to other by connecting them via the deployment settings. In this case, organizations must be connected.

To open the deployment setup, follow the steps given below. Remember that this feature is not available in the Developer Edition −

Step 1 − Go to Setup and search for 'Deploy'.

Step 2 − Click on 'Outbound Change Set' in order to create change set to deploy.

Step 3 − Add components to change set using the 'Add' button and then Save and click on Upload.

Step 4 − Go to the Target organization and click on the inbound change set and finally click on deploy.

SOAP API Calls to Deploy

We will just have a small overview of this method as this is not a commonly-used method.

You can use the method calls given below to deploy your metadata.

  • compileAndTest()
  • compileClasses()
  • compileTriggers()

Force.com Migration Tool

This tool is used for the scripted deployment. You have to download the Force.com Migration tool and then you can perform the file based deployment. You can download the Force.com migration tool and then do the scripted deployment.


No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...