HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
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.
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