Developer Guide Intro
Contents |
The Developer's Guide to the Force.com Platform
Welcome to the home page for The Developer's Guide to the Force.com Platform. This page is your overview to the methods, techniques and files you will use to prepare your Force.com organization to perform the hands-on exercises for this book.
The instructions contained in this document are subject to change and improvement as the underlying code and functionality evolve.
Philosophy behind the book
The Force.com platform is a rich and robust platform for developing and deploying applications. This book is intended as a compact introduction to the use of the platform for developers. As a developer, you are already familiar with basic development approaches, and are probably already skilled in the use of some development platform.
The Developer's Guide is aimed at delivering great value for volume. The application used for the book, a recruiting application, uses several data objects, as well as supporting components such as email templates and reports. There is no need for you to have to create all of these components - only as many as you need to understand the basics of the platform.
With that in mind, this site includes scripts you can run to initialize your organization to the proper state for each chapter. Sometimes, components will be added to an initialization script for a chapter to avoid forcing you to create them in a repetitive task. And each chapter also includes an application that will initialize the data in your organization to contain records which will make the application you build more meaningful.
A side benefit of this approach is that you will be able to read any chapter in the book as a stand-alone entity. You can simply initialize your Force.com organization with the appropriate scripts and actions and be ready for the exercises in the chapter. Of course, we believe that you will get the most value by reading the book from cover to cover in a sequential manner, and highly recommend this approach to get the most information about the Force.com platform.
Methodology
This books uses Force.com metadata as the key to its methodology. This metadata describes both the data structures and all other components used in your Force.com applications.
You can use the Metadata API to load metadata into your Force.com organization. Each chapter of this book has its own metadata script to load all required components. The Force.com Metadata API is additive - new metadata values will be added to existing metadata, but existing values will not be deleted. This quality means that you can direct metadata scripts from successive chapters into the same Force.com organization.
In addition to a metadata script for each chapter, you will have to run one metadata script to initialize your organization. You will need to have a total of five users in the Force.com organization which is used for the exercises in this book. You can use an existing organization, or grab a new Developer Edition organization to use specifically for this book. The exercises in this book have been designed for and tested with a Developer Edition organization.
Technique
You will use the Force.com Migration Tool to load metadata into your Force.com organization. This tool is a plug-in for Apache Ant, a common open-source tool used for handling all kinds of tasks. You can find information on this tool on this page. This page includes links to the Force.com Migration Tool Guide. You will have to install Ant as a prerequisite to using this Tool, an installation process that is described in the Guide.
As with most Force.com technology, the Migration Tool is frequently updated with additional functionality.
Important - The requirement to use the Force.com Migration Tool to run the intialization and chapter scripts is a temporary solution. Check back later for a more direct approach to adding metadata to your organization.
In practice
Once you get the Migration Tool installed, you can download this ZIPped file. The file unzips into a directory structure headed by the DevelopersGuide directory. This directory contains the build and the build.properties files which are used by the Migration Tool. The build file contains the commands you will use to load the Force.com metadata. The build.properties contains values for properties which are used by the Migration Tool for all scripts.
You will have to edit the build.properties file to to change the sf.username property to the value of the username for your organization, and the sf.password to the password for that organization. You may have to generate and include a security token with your password - for more information on the creation and use of a security token, please refer to Chapter 7 in the Developer's Guide.
Once you make these changes, you run the appropriate scripts by opening up a command window and migrating to the DevelopersGuide directory. When in this directory, you simply enter the following command
ant command_name
where command_name is the name of the appropriate Migration Tool command.
- If you are having trouble running any of the initialization routines in your current organization, you can always create a new Developer Edition organization, initialize that organization to the proper point and begin your work again.
Organization initialization
Once you have made these changes to the build.properties file, you can use the Migration Tool to initialize your organization. The command you will use is
ant InitUsers
The initialization process has to be run once for an organization. The process first uses a Migration Tool script to add a tab to the standard Force.com application named Initialize users. This tab leads to a page, as shown below.
The values you enter will be used to create four additional users for your organization. The data loading process which you will use for each chapter assumes that the organization has five users (these four plus the administrator), and will fail if five users are not present.
The four users will be given names to match those in the text, used primarily in Chapter Five on workflow and approvals. In addition, all four users will be given the same email address, as designated in the form above. This common address will receive incoming emails for all the users.
The page above also prompts for a domain name for all users. The domain name must take the format of domain.domain_suffix, where the domain_suffix is a standard like .com or .org. The initialization process uses this name to assign usernames for the four new users. Usernames must be unique across a Force.com instance - if the domain name you choose does not result in unqiue usernames, you will receive an error message on the page.
Chapter initialization
Once you have initialized your organization, you can initialize the organization for a specific chapter. The chapter initialization process uses the same type of command, as shown in the code below for Chapter 3 -
ant Chapter3
The actual commands and steps required for each chapter are listed in this document.
This process creates the components required to begin the chapter, as well as an application called Recruiting Data Loader, which is shown below.
Normally, you can simply use the Initialize data tab to load the data required for the exercises in a chapter. Some chapters may require you to add data to your organization in the middle of the chapter. For these chapters, the Add data tab is used when requested by the chapter text.
In the same way, some chapters require you to run additional Force.com Migration scripts in the middle of the chapter. These requirements are noted in the text and are described in the same document listed above.
Keep in mind that this data initialization process wipes out any existing data in the objects used for the examples in the book. You do not have to run this data initialization process; however, some examples in the book may be less meaningful without the data populated as part of this initialization process. You can use this same option to re-initialize the data in your organization at any time.
- Caution! – if you are using an existing org, the following entities will be updated by some or all of the metadata scripts.
- Applications -
- Recruiting
- Recruiting Data Loader
- Objects -
- Location
- Position
- Candidate
- Job Application
- Interview
- Recruiting Tracker
- Position Tracker
- A custom field, Last_Interview_Scheduled, on the User standard object
- Classes -
- AvailablePositionsController
- CandidateInterviewScheduledController
- customController
- dataLoadController
- EmailCandidateScheduleController
- positionExtension
- ProcessApplicant
- SendEMail
- testData
- testMethods
- testEmailMethods
- updateUserInterviewTimes
- updateUsers
- Components -
- slogo
- Pages -
- addData
- availablePositions
- candidateinterviewschedule
- emailCandidateSchedule
- initData
- initUsers
- JobApplications
- UpdateJobApps
- VisualforceExtension
- wizard1
- wizard2
- wizard3
- Layouts for all objects, with an additional layout for Non-technical Position for the Position object
- Tabs for all custom objects, as well as for
- Add_data
- Initialize_data
- Initialize_Users
- Interview_Wizard
- NewJobbApps
- Triggers
- assignInterviewers
- rejectUndereducatedTrigger
- Workflows for custom objects
If you wish to preserve your versions of these entities, or any of the data they contain, either do the exercises in the book in a different organization, or move your entities to a different organization.
Caveats
As described above, you will be using the Force.com Metadata API as the underlying mechanism for shaping the contents of your organization. Some of the functionality in the Force.com platform is not yet supported by the Metadata API, such as approvals and analytic snapshots. Because of this, if you do not implement these features as part of the exercises in the chapters, the Migration scripts will not load them, so your organization will not have the functionality built in those chapters.
As with all books, The Developer's Guide contains some errors. The errors are listed in this Errata document. Since some of these error affect the successful completion of the hands on exercises in the book, best practices strongly suggest that you review the errors found for a chapter before reading the chapter. Gaining some familiarity with potential issues before beginning the chapter will probably help you avoid potential frustration over encountering unforeseen issues.

