Saturday 18 April 2015

Replicating one Salesforce org to another + Mass Deployment + Best Practice + Salesforce

Recently I was trying to replicate one Salesforce Sandbox org to Developer edition org, Sandbox was fully developed, sandbox had many components + dependecies, you cannot just deploy everything in one shot, So you need to make a checklist before the deployment for the components you are going to deploy.

Start checking in the components in order of below list

  • Check Appexchange apps installed.
  • Standard Object Modifications i.e Custom Fields or Field History Tracking or Assignment Rules (Suggestion is to use IDE for this).
  • Custom Objects i.e Custom Object and Custom Settings ( Here you can face issue if you have formula fields which is using related objects field values like CustomObject__r.Phone__c in the formula field )
  • Remote Site Settings, Static Resources, Roles Custom Button and Custom Links etc
  • Now Trigger, Apex Classes, Test classes and Visualforce Components and Visualforce pages.


I am using ANT and IDE, if you are using ANT please specify the profiles each and every time in your package.xml file.

In writing its looks too less but it would be too much at the time of deployment, While deploying keep this in mind that we are not using change sets, now your only hope is ANT and IDE.
for ANT users while deploying specific Standard objects custom Fields and that is 50 in count and pasting the custom fields name in package file, that is seriously annoying process I feel. So according to the list we should deploy all the Standard and Custom object fully using IDE, below is the process of deployment using IDE, after that there is an ANT package file snippet that you can use to deploy everything from one org to another org.

Process of fetching all the components in the IDE for the deployment (Specificaly fetching Standard Objects custom Fields).

i. Go to IDE open you Project

ii. Right click on the Project and click on Force.com followed by Add/Remove Metadata Components.


iii. Now click on Add/remove button highlighted below


you will get this notification message click ok



iv. Now select those components that you want to add the metadata in your IDE, like I have select Standard Object and the fields.





v. After selecting the components, you can see the selected componenets then click Apply


vi. Now you have added the components in your IDE.


vii. Right click on the object and select FORCE.COM and Deploy to Server


viii. Pass you credential of the dev org.


ix. Click NEXT


X. Click NEXT and you are done now



I have shown the above process to deploy standard Objects fields and then Custom object in sequence without wasting you time in the creation of the of the package.xml file.

Now just put the below code format in your package.xml file keeping in mind the deployement is done of the dependent components according to list in the starting I mentioned.

1:       <types>  
2:      <members>*</members>  
3:      <name>ApexClass</name>  
4:    </types>  
5:    <types>  
6:      <members>*</members>  
7:      <name>ApexComponent</name>  
8:    </types>  
9:    <types>  
10:      <members>*</members>  
11:      <name>ApexPage</name>  
12:    </types>  
13:    <types>  
14:      <members>*</members>  
15:      <name>ApexTrigger</name>  
16:    </types>  
17:    <types>  
18:      <members>Lead.104</members>  
19:      <name>AssignmentRule</name>  
20:    </types>  

NOTE : Put star(*) when you want to deploy all the components.

The above process will surely help you, when you are mass deploying
Please go to these links for more information and expertise in ANT TOOL

Installing the Force.com Migration Tool
Force.com Migration Tool Guide
Using the Force.com Migration Tool

I am a great fan of ANT tool, and anybody will also become when we will use ANT AT ITS BEST.

Enjoy the force !!!

No comments:

Post a Comment