Wednesday, January 25, 2017

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 as deployment.
In short, this is movement of metadata from one organization to another. The reason is that you can't develop Apex in your Salesforce production organization. Live users accessing the system while you're developing can destabilize your data or corrupt your application.
deployment_process Tools available for deployment:
  • Force.com IDE
  • Change Sets
  • SOAP API
  • Force.com Migration Tool
As we are using Developer Edition for our development and learning purpose, so 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 you would like to deploy
eclipse_process_Step_1
Step 2: Once you clicked on 'Deploy to server' then enter the username and password of the organization in which you would like to deploy the Component.
eclipse_process_Step_2
By performing the above mentioned steps, your Apex components will be deployed to the target organization.

Deployment using Change Set

You could 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 below steps. Remember that this feature is not available in 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 'Add' button and then save and click on upload.
Step 4: Go to Target organization and click on 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 could use the below method calls 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 could perform the file based deployment. You could download the Force.com migration tool and then do the scripted deployment.

No comments:

Post a Comment