Home > Store

Development with the Force.com Platform: Building Business Applications in the Cloud, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Development with the Force.com Platform: Building Business Applications in the Cloud, 2nd Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2012
  • Dimensions: 7" x 9"
  • Edition: 2nd
  • Book
  • ISBN-10: 0-321-76735-7
  • ISBN-13: 978-0-321-76735-6

Build Powerful, Scalable, Cloud-Based Enterprise Solutions Fast with the Newest Version of Force.com


Using Force.com, you can build enterprise applications with world-class value, scalability, and reliability--and do it in days or weeks, not months or years. In this book, top Force.com developer Jason Ouellette offers all the technical guidance and sample code you’ll need to get outstanding results with the newest version of Force.com.

Drawing on his experience building three of the world’s top ten Force.com applications, Jason Ouellette walks you through the entire project lifecycle, from identifying potential applications to prototyping, coding, and deployment. Throughout, he offers practical insights you won’t find in Salesforce.com’s documentation--or anywhere else.

This edition thoroughly covers Force.com’s most powerful new improvements, including Batch Apex, Chatter, Adobe Flex and XML support, and the Force.com Free Edition. Throughout, Ouellette covers all you need to know about user interfaces, database design, workflow, analytics, security, and much more. All his code samples can be run and adapted using a no-cost Force.com Developer Edition account. 

  • Learn how Force.com provides customizable business application infrastructure and what makes it unique
  • Master the Force.com database and configure its built-in security features
  • Use advanced business logic, including Batch Apex, managed sharing, and metadata queries
  • Build intuitive user interfaces with Visualforce and extend them with JavaScript, Adobe Flex, or Force.com Sites
  • Master Force.com’s options for seamlessly integrating existing systems and choose the right alternative for your project
  • Create flexible reports and display them in dashboards
  • Deliver applications in multiple languages and support multiple currencies
  • Add social media features with Force.com’s new Chatter collaboration tools



Download free code files here


Author's Site

Link to author site

Sample Content

Online Sample Chapter

Introducing Force.com

Table of Contents

Preface     xvi

Foreword     xxi

Chapter 1: Introducing Force.com    1

Force.com in the Cloud Computing Landscape    1

Platform as a Service (PaaS)     2

Force.com as a Platform    4

Force.com Services     7

Inside a Force.com Project    9

Project Selection    9

Team Selection     11

Lifecycle     13

Tools and Resources     16

Sample Application: Services Manager     18

Background    18

User Roles    19

Development Plan    19

Summary     20

Chapter 2: Database Essentials    23

Overview of Force.com’s Database     23

Objects     23

Fields     25

Relationships     27

Query Language    28

Data Integration     31

Working with Custom Objects    33

Force.com Developer Edition    33

Tools for Custom Objects     35

Object Creation     36

Field Creation     39

Entering and Browsing Data     42

Sample Application: Data Model     45

Logical Data Model     45

Force.com Data Model    50

Implementing the Data Model    52

Importing Data    58

Summary     64

Chapter 3: Database Security    65

Overview of Database Security     65

Object-Level Security     67

Profiles     68

Field-Level Security     70

Record-Level Security    71

Record Ownership     72

User Groups     72

Sharing Model     73

Sample Application: Securing Data    77

Designing the Security Model     78

Implementing the Security Model     81

Testing the Security Model     86

Summary     91

Chapter 4: Additional Database Features     93

Dependent Fields    94

Record Types    95

Defining Record Types    95

Securing Record Types    97

Using Record Types    99

Roll-Up Summary Fields     100

Field History Tracking    102

Tags     104

Enabling Tags    104

Using Tags    104

Force.com Connect Offline    104

Administration of Force.com Connect Offline     105

Using Force.com Connect Offline    106

Custom Settings    107

Using List Custom Settings    108

Using Hierarchy Custom Settings    109

Sample Application: Applying the Features    110

Dependent Fields for Skill Types    111

Roll-Up Summary Fields for Project Reporting    113

Force.com Connect Offline for Staffing    114

Summary    116

Chapter 5: Business Logic     119

Introduction to Apex     120

Introducing the Force.com IDE     121

Installation     121

Force.com Perspective    121

Force.com Projects    122

Problems View     123

Schema Explorer     123

Apex Test Runner View     124

Execute Anonymous View    124

Apex Language Basics    124

Variables     125

Operators     129

Arrays and Collections    130

Control Logic     132

Understanding Governor Limits    136

Database Integration in Apex     137

Database Records as Objects     137

Database Queries    139

Persisting Database Records     144

Database Triggers    146

Database Security in Apex    149

Object-Oriented Apex     149

Encapsulation     150

Information Hiding    154

Modularity    155

Inheritance    155

Polymorphism     157

Debugging and Testing    158

Debugging    158

Testing    161

Sample Application: Validating Timecards     162

Force.com IDE Setup    163

Creating the Trigger    163

Unit Testing    164

Summary     166

Chapter 6: Advanced Business Logic     169

Aggregate SOQL Queries    170

Aggregate Functions    170

Grouping Records    171

Grouping Records with Subtotals     172

Additional SOQL Features     174

Inner Join and Outer Join     174

Semi-Join and Anti-Join     176

Multi-Select Picklists     179

Salesforce Object Search Language (SOSL)     180

SOSL Basics    180

SOSL in Apex     181

Transaction Processing     182

Data Manipulation Language (DML) Database Methods    183

Savepoints    184

Record Locking     185

Apex Managed Sharing     187

Sharing Objects     187

Creating Sharing Rules in Apex    188

Sending and Receiving Email    192

Sending Email    193

Receiving Email     197

Dynamic Apex    200

Dynamic Database Queries    200

Schema Metadata     202

Custom Settings in Apex    204

Sample Application: Adding Email Notifications    206

Summary    207

Chapter 7: User Interfaces    209

Introduction to Visualforce     210

Overview of Visualforce     210

Getting Started with Visualforce     212

Visualforce Controllers    215

Standard Controllers    215

Custom Controllers     217

Controller Extensions    221

View Components     222

View Component Basics    222

Data Components    224

Action Components     227

Primitive Components    228

Force.com-Styled Components    229

Force.com User Interface Components    232

Visualforce and the Native User Interface    236

Standard Pages    237

Standard Buttons    240

Page Layouts     240

Custom Buttons and Links    240

Custom Tabs     242

Visualforce in Production    242

Debugging and Tuning    243

Security     245

Error Handling    247

Governor Limits     248

Unit Tests    249

Sample Application: Skills Matrix    250

Basic Implementation     251

Full Implementation    252

Implementation Walkthrough     252

Summary     259

Chapter 8: Advanced User Interfaces    261

Asynchronous Actions     261

Partial Page Refresh    262

Action as JavaScript Function    263

Action as Timed Event     264

Action as JavaScript Event    265

Indicating Action Status    266

Modular Visualforce     268

Static Resources    268

Inclusion     269

Composition     269

Custom Visualforce Components     271

Extending Visualforce     273

Using JavaScript Libraries    273

Adobe Flex and Visualforce    274

Force.com Sites     281

Sample Application: Enhanced Skills Matrix     285

Summary     288

Chapter 9: Batch Processing     291

Introduction to Batch Apex     292

Batch Apex Concepts     292

Understanding the Batchable Interface    293

Applications of Batch Apex     294

Getting Started with Batch Apex     295

Developing a Batch Apex Class     295

Working with Batch Apex Jobs     296

Using Stateful Batch Apex     299

Using an Iterable Batch Scope     300

Limits of Batch Apex     302

Testing Batch Apex     303

Scheduling Batch Apex    303

Developing Schedulable Code    304

Scheduling Batch Apex Jobs     304

Sample Application: Missing Timecard Report    306

Creating the Custom Object    307

Developing the Batch Apex Class    308

Testing the Missing Timecard Feature    310

Summary    310

Chapter 10: Integration    313

Force.com Integration Solutions    313

Outbound Messaging     314

Salesforce-to-Salesforce (S2S)     319

Developing Custom Integrations     329

Calling Web Services from Apex Code    329

Using HTTP Integration    331

Sample Application: Anonymous Benchmarking    334

Visualforce Page Design     334

Visualforce Controller Design    336

Integrating the Web Service    337

Sample Implementation     339

Summary     342

Chapter 11: Advanced Integration    345

Understanding Force.com Web Services    346

Basics of Force.com Web Services    346

Generating Stub Code    349

Logging In     351

Force.com Data Types in SOAP     355

Error Handling     356

Using the Enterprise API     357

Retrieving Records    357

Writing Records    359

Building Custom Web Services in Apex    362

Understanding Custom Web Services     362

Service Definition     363

Calling a Custom Web Service     364

Introduction to the Metadata API     365

Overview     366

Getting Started with the Metadata API     366

Using the Force.com REST API     368

Overview of Force.com REST API     368

Authentication     369

API Walkthrough     369

Sample Application: Database Integration     373

Integration Scenario     373

Implementation Strategy     373

Sample Implementation     374

Summary     377

Chapter 12: Additional Platform Features    379

Workflow and Approvals     379

Introduction to Workflow     380

Getting Started with Approval Processes     382

Introduction to Analytics     388

Working with Reports     389

Configuring Dashboards     392

Using Analytic Snapshots     393

Force.com for International Organizations     395

Multilingual Support     395

Using Multiple Currencies     398

Advanced Currency Management (ACM)      400

Using Single Sign-On     402

Federated Single Sign-On     402

Delegated Single Sign-On     407

Sample Application: Project Map Dashboard     410

Summary     416

Chapter 13: Social Applications     417

Overview of Chatter     418

Chatter Concepts     418

Configuring Chatter     419

Understanding the Chatter Data Model     424

Chatter Posts     425

Chatter Comments     429

Feed-Tracked Changes     430

Followed Records     431

Chatter in Visualforce     432

Sample Application: Follow Project Team     434

Summary     437

Index     439


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020