Wednesday, June 26, 2013

Deployment in Salesforce

Created By: Nirmal Christopher
                      SFDC  Technical consultant

Change Sets and Deployment Production

What is a Change set???

A change set is a means by which one organization can send customizations to another organization.
  • An outbound change set is a change set created in the organization you are logged into and want to send to another organization.
  • An inbound change set is a change set that has been sent from another organization to the organization you are logged into.
  • Change sets can only contain modifications you can make through the setup menu.
  • Change sets may contain customizations to existing components or new components, but can't be used to delete or rename components.
Let me walk you through the steps involved in deploying components from sandbox to production

Step #1:
The first step involved in deployment from sandbox to production is to make sure proper deployment connections has been made in the sandbox instance and production instance.  
  Navigate as follows
User Menu->Setup->App Setup->Deploy->Deployment Connections. Please refer the screen shot below for further clarification.
Here you can see the list of connections available for  sandbox production seems the connection to production environment is already active.



·         A deployment connection is automatically created between all related organizations whenever a sandbox is created.
·         Each organization must be authorized to send and receive change sets.
·         The deployment connection list shows which organizations can upload changes to this organization, and which organizations allow this organization to upload changes to them.

Step #2

The step 2 would be creating outbound change set and its components in sandbox.
Please make sure that Allow inbound changes option is checked true in Production org in deployment connections option else you will get and error message if you try to upload the components into the production org. Refer the screen shot below.

You can navigate the outbound change set component as follows User Menu->Setup->App Setup->Deploy->Out Bound changes set.

Click New to create a new outbound change set. It will navigate to a screen where you can see a Name field(Required field) and description field. Fill the fields and click Save.

It will navigate to a page like this (refer the screenshot below).




Now click ADD to select the list of components it will navigate to another page where you will find a dropdown list which will show the list available components for Example we will consider a simple workflow for deployment. 





After choosing workflow rule from the drop down you can see the list of all workflows available for deployment. Choose the required workflows click add to change set.



Now the change set is created for deployment we have to make sure that the dependent components for that chosen components is also added in the outbound change set. To achieve this click on the View/Add Dependencies Button will again navigate to the previous page which will show the list of dependent components. Select all the components available and click  add to change set button and make sure all the dependent components are added in the change set.

Choose appropriate profiles required in the same change set. And click the upload button. Now the components will be added in the production org and a mail will be sent to the Sandbox administrator.

Step #3:
The deployment time might vary from few minutes to few hours. Now log in into production org and navigate to inbound change sets as follows
 User Menu->Setup->App Setup->Deploy->Inbound changeset
Now the user will be able to see the list or inbound change sets which we sent from sandbox.  Will be available in Change Sets Awaiting Deployment section.
 Click the link for the inbound change set in this section now the screen will navigate to the list of components available there you can see Validate and Deploy buttons. Pressing validate button will mock the changes which will be made in the system after deployment and it produces results. So its always a good practice to choose validate button before deploying. If the result is success then the change set is ready to deploy now.

Point to remember before deploying

·         Deployment should be done in a sequential order  to avoid errors I.e in this order
·         Custom Objects
·         Custom fields
·         Profiles
·         Roles
·         Templates
·         Pagelayouts
·         Record Types
·         Email Alerts
·         Field Updates
·         Workflow rules
·         VF pages
·         Test Classes
·         Classes
·         Triggers
·         Validation Rules.

If you press the view dependency button all the available components will be pulled sequentially so the user really have to mind the sequence.