Table Of Contentwww.it-ebooks.info
Praise for Development with the Force.com
Platform, Second Edition
“When the first edition of this book came out,it was welcomed by everyone
working on the Force.com platform.The book did an excellent job of locating the
Force.com platform in the overall code development sphere.And it was the first
comprehensive guide to the platform.But that was 2009,before Chatter,before
the REST API,before releases 16 through 21 of the Force.com platform.
“The second edition adds a whole new chapter on Chatter.In the new chapter,
Mr.Ouellette continues his clear,logical explanation of the underlying data mod-
els and explains what you can,and cannot,do with Chatter and Apex code and
Visualforce pages.I learned more about using and developing Chatter apps in 30
minutes with the new edition than in countless Salesforce.com keynotes,sessions,
and webinars.
“REST (Representational State Transfer),another new topic,also is covered in
detail.Many of the coding examples in the original edition have been reworked to
use REST.This not only provides the reader with a good understanding of how to
use REST but also explains when to use REST.”
—David Claiborne,Principal,The Claiborne Company
“Development with the Force.com Platform continues to be the only book with
beginning-to-end information on developing Force.com applications.This second
edition keeps readers up-to-date with the latest additions to the platform.”
—John Rotenstein,Author of theEnforcer.netblog on Force.com development
“Jason Ouellette’s book is a must-have for all Salesforce developers.It can act as an
introductory text on the Salesforce platform for a new developer and can also act
as a reference book for an experienced Salesforce developer.The book provides
depth as well as breadth on Apex,Visualforce,and other related technologies.”
—Naveen Gabrani,CEO,Astrea IT Services
www.it-ebooks.info
“There is no substitute for learning the unique aspects of the Force.com platform
and Apex language directly from an expert such as Jason Ouellette,who shares his
practical experience in this well-written and updated guide.This invaluable
resource for learning to use the platform correctly and efficiently is truly a gift for
anyone learning to build applications in the Salesforce.com cloud.”
—Mark Richer,Internet Consultant,Able Minds
“Literally everything you need to know to develop a product on Force.com…who
you need on the team,what tools to use,and how to use them in a clear,concise,
and complete package.A must-have for Force.com development teams.”
—Jason Monberg,VP of Product Management,MarkLogic Corporation
“Development with the Force.com Platform is a perfectly practical and consistently
useful guide to developing on the leading cloud business platform.It is for begin-
ners and pros alike,without any of the usual dogma or fluff that often serves as
filler in technical publications.”
—Titash Bardhan,Product Manager,PSA,FinancialForce.com
“Jason Ouellette is clearly a master of this domain.He distills its complexity into
simplified,choice paths,creating the perfect companion for any Force.com aspi-
rant.This second edition includes an exceptional chapter on social applications
where Jason combines his experience with his intuitive and accessible writing style
to demystify the Collaboration Cloud.Using this book as your guide with the lat-
est Force.com technical documentation as your library,you will have all you need
to succeed on the platform.”
—Adam Purkiss,Force.com Architect and Twilio Developer Contest Winner
“Jason does a thorough job explaining how to develop a business application on the
Force.com platform,leaving out the hype often surrounding Salesforce.com.Web
developers and DBAs will find the book valuable in learning to apply their rela-
tional modeling skills to the Force.com data model,designed to reduce develop-
ment time.Experienced Force.com developers are likely to find new features of the
platform that they may have overlooked in the quarterly updates to the platform.”
—Christian G.Warden,Director of Marketing Systems,CRC Health Group
“This is an indispensable reference for all Force.com developers.If there is some-
thing we need to know about building on Force.com,we turn to Development
with the Force.com Platform,Second Edition.It is that good.”
—Howard A.Brown,Founder and CEO,DemandResults
www.it-ebooks.info
Development with
the Force.com
Platform
Second Edition
www.it-ebooks.info
This page intentionally left blank
www.it-ebooks.info
Development with
the Force.com
Platform
Second Edition
Building Business Applications
in the Cloud
Jason Ouellette
Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Cape Town • Sydney • Tokyo • Singapore • Mexico City
www.it-ebooks.info
Many of the designations used by manufacturers and sellers to distinguish their products Editor-in-Chief
are claimed as trademarks. Where those designations appear in this book,and the pub- Mark Taub
lisher was aware of a trademark claim,the designations have been printed with initial capi-
Acquisitions Editor
tal letters or in all capitals.
Trina MacDonald
The author and publisher have taken care in the preparation of this book,but make no Development
expressed or implied warranty of any kind and assume no responsibility for errors or omis- Editor
sions. No liability is assumed for incidental or consequential damages in connection with or Songlin Qiu
arising out of the use of the information or programs contained herein.
Managing Editor
The publisher offers excellent discounts on this book when ordered in quantity for bulk pur- Kristy Hart
chases or special sales,which may include electronic versions and/or custom covers and
Project Editor
content particular to your business,training goals,marketing focus,and branding interests.
Betsy Harris
For more information,please contact:
Copy Editor
U.S. Corporate and Government Sales
Paula Lowell
(800) 382-3419
[email protected] Indexer
Erika Millen
For sales outside the United States,please contact:
Proofreader
International Sales Water Crest
[email protected] Publishing
Visit us on the Web: informit.com/aw Technical
Reviewers
Copyright © 2012 Pearson Education,Inc. David Cheng
Naveen Gabrani
All rights reserved. Printed in the United States of America. This publication is protected by
Colin Loretz
copyright,and permission must be obtained from the publisher prior to any prohibited repro-
duction,storage in a retrieval system,or transmission in any form or by any means,elec- Publishing
tronic,mechanical,photocopying,recording,or likewise. For information regarding Coordinator
permissions,write to: Olivia Basegio
Book Designer
Pearson Education,Inc.
Gary Adair
Rights and Contracts Department
501 Boylston Street,Suite 900 Compositor
Boston,MA 02116 Nonie Ratcliff
Fax (617) 671 3447
Screenshots © 2012 Salesforce.com,Inc. All rights reserved.
ISBN-13: 978-0-321-76735-6
ISBN-10: 0-321-76735-7
First printing July 2011
Library of Congress Cataloging-in-Publication Data
Ouellette,Jason,1973-
Development with the Force.com platform : building business applications in the cloud /
Jason Ouellette.
p. cm.
ISBN 978-0-321-76735-6 (pbk. : alk. paper)
1. Web services. 2. Application software—Development. 3. Force.com (Electronic
resource) 4. Cloud computing. 5. Business—Data processing. 6. Service-oriented
architecture (Computer science) I. Salesforce.com (Firm) II. Title.
TK5105.88813.O94 2012
004.6’54—dc23
2011015142
www.it-ebooks.info
❖
To Tracey
“Life can only be understood backwards;
but it must be lived forwards.”
—Søren Kierkegaard
❖
www.it-ebooks.info
Table of Contents
Preface xvi
Foreword xxi
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
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
www.it-ebooks.info
Table of Contents ix
Sample Application: Data Model 45
Logical Data Model 45
Force.com Data Model 50
Implementing the Data Model 52
Importing Data 58
Summary 64
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
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
www.it-ebooks.info