SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.
The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Master Force.com, Today’s Fastest, Most Flexible Cloud Development Platform
With Salesforce.com’s Force.com platform, you can build and deploy powerful cloud-based enterprise applications faster than ever before. Now, Jason Ouellette gives you all the practical, technical guidance you need to make the most of the newest Force.com releases in your own custom cloud applications.
Throughout, he adds new code and updated best practices for rapidly prototyping, building, and testing production-quality Force.com solutions. This edition’s extensive new coverage includes Developer Console, JSON, Streaming and Tooling APIs, Bulk API, Force.com Canvas, REST integration, support for Web MVC frameworks, Dynamic Apex and Visualforce, and an all-new chapter on mobile user interfaces.
Ouellette covers the entire platform: UIs, database design, analytics, security, and many other topics. His code examples emphasize maintainability, flexibility, and seamless integration—and you can run and adapt all of them with a free Force.com Developer Edition account. Coverage includes:
If you’re already building Web or mobile applications, take your next giant step into enterprise cloud development—with Development with the Force.com Platform, Third Edition.
All code examples in this book are available on Github at http://goo.gl/fjRqMX, and as a Force.com IDE project on Github at https://github.com/jmouel/dev-with-force-3e.
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 12
Tools and Resources 15
Sample Application: Services Manager 17
Background 17
User Roles 18
Development Plan 19
Summary 19
2 Database Essentials 21
Overview of Force.com’s Database 21
Objects 22
Fields 23
Relationships 25
Query Language 26
Data Integration 29
Working with Custom Objects 32
Force.com Developer Edition 32
Tools for Custom Objects 33
Object Creation 35
Field Creation 38
Entering and Browsing Data 41
Additional Database Features 43
Sample Application: Data Model 49
Data Model Design Goals 49
Data Model Specification 50
Implementing the Data Model 58
Importing Data 64
Summary 69
3 Database Security 71
Overview of Database Security 71
Object-Level Security 74
Profiles 74
Permission Sets 76
Field-Level Security 77
Record-Level Security 79
Record Ownership 79
User Groups 80
Sharing Model 80
Sample Application: Securing Data 84
Designing the Security Model 85
Implementing the Security Model 88
Testing the Security Model 94
Summary 98
4 Business Logic 99
Introduction to Apex 100
Introducing the Force.com IDE 101
Installation 101
Force.com Perspective 101
Force.com Projects 103
Problems View 103
Schema Explorer 103
Apex Test Runner View 103
Execute Anonymous View 104
Apex Language Basics 105
Variables 105
Operators 109
Arrays and Collections 110
Control Logic 113
Object-Oriented Apex 117
Understanding Governor Limits 120
Database Integration in Apex 120
Database Records as Objects 121
Database Queries 122
Persisting Database Records 128
Database Triggers 130
Database Security in Apex 133
Debugging Apex Using Developer Console 133
Checkpoints 133
Execution Logs 134
Unit Tests in Apex 136
Test Methods 136
Test Data 136
Running Tests 137
Sample Application: Validating Timecards 138
Force.com IDE Setup 138
Creating the Trigger 138
Unit Testing 140
Summary 142
5 Advanced Business Logic 143
Aggregate SOQL Queries 144
Aggregate Functions 144
Grouping Records 145
Grouping Records with Subtotals 146
Additional SOQL Features 148
Inner Join and Outer Join 148
Semi-Join and Anti-Join 150
Multi-Select Picklists 154
Salesforce Object Search Language (SOSL) 154
SOSL Basics 155
SOSL in Apex 155
Transaction Processing 156
Data Manipulation Language (DML) Database
Methods 157
Savepoints 159
Record Locking 161
Apex Managed Sharing 162
Sharing Objects 162
Creating Sharing Rules in Apex 163
Sending and Receiving Email 168
Sending Email 168
Receiving Email 172
Dynamic Apex 174
Dynamic Database Queries 175
Schema Metadata 177
Dynamic Instance Creation 179
Custom Settings in Apex 180
Sample Application: Adding Email Notifications 181
Summary 183
6 User Interfaces 185
Introduction to Visualforce 186
Overview of Visualforce 186
Getting Started with Visualforce 188
Visualforce Controllers 191
Standard Controllers 191
Custom Controllers 193
Controller Extensions 197
View Components 198
View Component Basics 198
Data Components 200
Action Components 203
Primitive Components 204
Force.com-Styled Components 205
Force.com User Interface Components 208
Visualforce and the Native User Interface 209
Standard Pages 210
Standard Buttons 213
Page Layouts 213
Custom Buttons and Links 215
Custom Tabs 215
Visualforce in Production 215
Debugging and Tuning 215
Security 218
Error Handling 220
Governor Limits 221
Unit Tests 222
Sample Application: Skills Matrix 222
Basic Implementation 224
Full Implementation 224
Implementation Walk-Through 225
Summary 232
7 Advanced User Interfaces 233
Asynchronous Actions 233
Partial Page Refresh 234
Action as JavaScript Function 235
Action as Timed Event 237
Action as JavaScript Event 237
Indicating Action Status 238
Modular Visualforce 240
Static Resources 241
Inclusion 242
Composition 242
Custom Visualforce Components 244
Dynamic Visualforce 246
Dynamic Field References 246
Component Generation 248
Single-Page Applications in Force.com 250
JavaScript Remoting 250
Force.com with AngularJS 251
Introduction to Force.com Sites 254
Enabling and Creating a Site 254
Security Configuration 255
Adding Pages to a Site 256
Authenticating Users 257
Sample Application: Enhanced Skills Matrix 258
Summary 262
8 Mobile User Interfaces 263
Overview of Salesforce Mobile Technology 263
Salesforce Applications 264
Custom Applications 265
Getting Started with Mobile Web Applications 267
Frameworks 268
Data Access 269
Deployment 270
Sample Application: Mobile Timecard Entry 272
Summary 279
9 Batch Processing 281
Introduction to Batch Apex 282
Batch Apex Concepts 282
Understanding the Batchable Interface 283
Applications of Batch Apex 284
Getting Started with Batch Apex 285
Developing a Batch Apex Class 285
Working with Batch Apex Jobs 286
Using Stateful Batch Apex 289
Using an Iterable Batch Scope 290
Limits of Batch Apex 292
Testing Batch Apex 293
Scheduling Batch Apex 293
Developing Schedulable Code 293
Scheduling Batch Apex Jobs 294
Sample Application: Missing Timecard Report 296
Creating the Custom Object 297
Developing the Batch Apex Class 298
Testing the Missing Timecard Feature 299
Summary 300
10 Integration with Force.com 301
Apex Callouts 301
Calling RESTful Services from Apex 302
Calling SOAP Services from Apex 304
Calling into Force.com Using REST 306
Getting Started with Force.com REST API 306
Force.com REST API Walk-Through 308
Creating Custom Apex REST Web Services 312
Calling into Force.com Using SOAP 314
Understanding Force.com SOAP API 314
Using the Enterprise API 322
Creating Custom Apex SOAP Web Services 326
Sample Application: Anonymous Benchmarking 329
Visualforce Page Design 330
Visualforce Controller Design 331
Integrating the SOAP Web Service 333
Sample Implementation 335
Summary 338
11 Advanced Integration 339
Introduction to the Force.com Streaming API 340
Overview 340
Getting Started with Force.com Streaming API 341
Working with the Force.com Bulk API 344
Overview 345
Importing Records 346
Exporting Records 347
Getting Started with Force.com Canvas 349
Overview 349
Getting Started with Force.com Canvas 350
Introduction to the Force.com Tooling API 354
Overview 355
Getting Started with Force.com Tooling API 355
Understanding the Force.com Metadata API 360
Overview 360
Getting Started with the Metadata API 361
Sample Application: Database Integration 363
Integration Scenario 363
Implementation Strategy 363
Sample Implementation 364
Summary 366
12 Social Applications 369
Overview of the Chatter Data Model 370
Chatter Posts 370
Chatter Comments 374
Feed-Tracked Changes 376
Followed Records 376
Using Chatter in Apex 378
Introduction to the Chatter REST API 379
Working with Chatter Visualforce Components 380
Sample Application: Follow Project Team 382
Summary 386
Index 387