Sandbox & Metadata Migrations or Deployments in Salesforce
What is a sandbox?
Sandbox is a copy of your production organization. You can create multiple copies of your organization in separate environments for different purposes such as development, testing, and training, without compromising the data and applications in your production organization. To know more about sandboxes see hollowing posts.
Metadata Migrations/Deployments in Salesforce
What is Metadata? metadata describes and gives information about other data. Here in this page, I will explain What is metadata in salesforce, What is the importance of metadata in salesforce and also how can we perform metadata migrations in salesforce.
In force.com platform every configuration/customization will store in the form of metadata. Metadata migration means deploying your components from one instance to other instance. For example, you are developing your project/application in one of your development sandbox. After completion of your development, you need to deploy that project/application form your development environment to TEST/PRODUCTION. In this scenario in salesforce whatever developed by you will store in the form of metadata in Force.com platform. If you want to deploy those components you can simply retrieve that data and you can deploy that data into your target environment.
In Salesforce we have different ways to do deployments. Those are
1. Using changesets
2. By using the Migration tool/ ANT tool
3. By using force.com IDE
You can use any one of the above ways to do deployments in salesforce. Apart from these three ways, we can set up continuous integration to automate the deployments in salesforce.
Here I will explain the above three ways to do deployments. Before going to that we will discuss about test class coverage. If you want to deploy your code to production at least 75% of your Apex code is covered by unit tests without fail.
Below are the important points yo have to take care before deployment in production.
- At least 75% of your Apex code must be covered by unit tests, and all of those tests must complete successfully.
- Every trigger must have some test coverage.
- All classes and triggers must compile successfully.
Now here in this page, I will explain about three deployment methods.
1. Metadata Migration by using changesets:
In salesforce change set is used to deploy metadata between two instances (i.e. related sandboxes to a sandbox, sandbox to production). Changeset is a very easy way to do deployments in salesforce. This just points and click tool to do deployments.
Steps to use changesets:
1. Create connections between your source and target environments.
2. Create outbound changeset and add components to that outbound changeset in your source instance. And upload that outbound change set to your target instance.
3. Go to inbound changeset in your target instance and deploy that changeset.
For a small set of components, you can use change sets to do deployments in salesforce. For a large set of deployments preparing changeset will take more time.
2. Metadata migration by using Migration tool/ ANT tool
The migration tool is used to deploy metadata between two environments in salesforce. Basically, it is an ant-based tool. To use this tool you need have JDK, ANT & jar file provided by Salesforce. Once you configure this in your system you can easily do deployments.
You can easily handle a large set of components by using this migration tool.
3. About force.com IDE will post later…