Deploy Force.com Applications Faster


Deploy Force.com Applications to Production Faster

One of the powerful aspects of the Force.com platform is that it enables developers and admins to quickly prototype many potential solutions for their customers. One side effect of this iterative development process can be a development organization that is cluttered with obsolete custom objects and fields. As insurance against future requirements change, some developers and admins may not want to delete these customizations. In this scenario, I’ve found that the deployment process can become a long exercise in checking and unchecking checkboxes in the IDE’s Deployment Wizard.

The solution is to deploy the smallest subset of configuration changes possible. Develop your Force.com applications as normal in your Developer Edition organization or Sandbox organization. Once you’re ready to deploy to your Production organization, create a new project in the IDE that contains only the exact items that you want to deploy. Then deploy your application to Production from the new project.

Deployment Process

Create a second project for your Developer Edition org. This will be your “clean” project:

Image:1.1_New_Project_Dialog.png


Click on the "Selected metadata components" radio button and then click on the "Choose" button in step 2:

Image:1.2_New_Project_Dialog.png


In the next step, only retrieve the exact metadata components that you want to deploy. In this example, we’re going to deploy the Bonus__c custom object.

Image:Choose Metadata Components Dialog.png


If you have any Field Level Security settings, you can deploy them by selecting the Profile metadata components as well. In this case, we do want to deploy some Field Level Security settings that will prevent everyone except for System Administrators from being able to view the values in the Bonus__c.Annual_Salary__c field. If you neglect to select the Profile components, your Field Level Security rules will not be deployed into your Production organization. Data could be exposed inadvertently as a result.

Image:Choose Metadata Components Dialog - Profiles.png


The confirmation window will contain all of your selected metadata components. Click the "Finish" button to create your project in the IDE.

Image:Selected Metadata Components Dialog.png


Your project should now look like this:

Image:4_Package_Snapshot.png


The next step is to deploy to our Production environment from our clean project by right-clicking on the ‘src’ directory and selecting Force.com > Deploy to Server.

If we had been deploying from our full development project, the deployment wizard would look like this:

Image:5.1_Deployment_Wizard.png


Instead, our deployment wizard looks much cleaner:

Image:5.2_Deployment_Wizard.png


Finally, click on the Next button to deploy to Production.


Implicit Security Benefit and References

One added benefit of deploying in this manner is that you also don’t have to worry about overwriting your Production org’s Profile settings with your Developer org’s Profile settings. The Metadata API Developer’s Guide contains more information about the Profile component.

For more details on editing the package.xml manifest file, see: Force.com Migration Tool Guide > Using the Force.com Migration Tool > Constructing a Project Manifest.


More questions?

Check out the Force.com Discussion Boards, where you can find answers posted by top experts from the developer community.