Table Of ContentSalesforce Platform Developer
I Certification Guide
Expert tips, techniques, and mock tests for the Platform
Developer I (DEV501) certification exam
Jan Vandevelde
Gunther Roskams
BIRMINGHAM - MUMBAI
Salesforce Platform Developer I Certification
Guide
Copyright © 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Chaitanya Nair
Content Development Editor: Ruvika Rao
Technical Editor: Gaurav Gala
Copy Editor: Safis Editing
Project Coordinator: Vaidehi Sawant
Proofreader: Safis Editing
Indexer: Rekha Nair
Graphics: Alishon Mendonsa
Production Coordinator: Jayalaxmi Raja
First published: May 2019
Production reference: 1220519
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78980-207-8
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.packt.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
customercare@packtpub.com for more details.
At www.packt.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors
About the authors
Jan Vandevelde is a Salesforce MVP, speaker, trainer, and blogger, and a Senior Salesforce
Consultant at Salesforce Platinum Partner 4C. He is based in Belgium. He has been working
on the Force.com platform since 2009. Currently, he is working as a Salesforce Consultant
and is a regular contributor to the Trailblazer Community.
He has 15 certifications in Salesforce. He works on all aspects of Salesforce and is an expert
in data migration, configuration, customization, and development, with his main expertise
being in Sales Cloud, Service Cloud, Community Cloud, and Salesforce Quote-to-Cash. He
is the leader of the Belgium User Group of Salesforce. He is one of the board members of
Europe's community-led event, YeurDreamin.
I would like to thank my parents, wife, son, and colleagues at 4C for supporting me in
every step of my life and career. I would like to thank Packt Publishing for giving me this
opportunity to share my knowledge via this book.
Gunther Roskams is a 7x certified Salesforce Application Architect, integration specialist,
and Senior Salesforce Developer at Salesforce Platinum Partner 4C. He designs many
(integration) solutions and gives advice about how to integrate Salesforce with other
platforms or ERPs. Besides that, he still likes to develop nice Salesforce applications with
the newest standards and technologies, together with the Salesforce best practices.
You can follow Gunther on Twitter via @guntherRoskams, or on LinkedIn as Gunther
Roskams.
About the reviewers
Maarten Devos is a Salesforce Developer at 4C, with over 5 years' experience in Salesforce.
He is Salesforce Certified Developer I, Admin & Integration Architecture Designer. You can
find him on LinkedIn as Maarten Devos.
Marie-Anne Wouters is a Business Analyst at 4C. She is a Certified Administrator,
Salesforce CPQ Specialist and App Builder. Marie-Anne has reviewed this book as a test
subject, being a consultant with no prior programming knowledge, making sure all
concepts were explained clearly.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com
and apply today. We have worked with thousands of developers and tech professionals,
just like you, to help them share their insight with the global tech community. You can
make a general application, apply for a specific hot topic that we are recruiting an author
for, or submit your own idea.
Table of Contents
Preface 1
Section 1: Fundamentals, Data Modeling, and
Management
Chapter 1: Salesforce Fundamentals 7
Considerations when developing in a multi-tenant environment 8
What is multi-tenancy? 8
The MVC paradigm 11
The core CRM objects 13
Leads 13
Accounts 15
Contacts 17
Opportunities 19
Extending an application's capabilities using AppExchange 19
Common use cases for declarative customization 22
Objects and fields 23
Formula fields 24
Rollup summary fields 26
Validation rules 26
WFR 27
Approval processes 28
The Process Builder 30
Lightning flow 32
Summary 35
Quiz 35
Chapter 2: Understanding Data Modeling and Management 38
Data modeling 39
Creating an app 40
Creating custom objects and custom fields 42
Creating records 45
Relationship types 47
Creating relationships 50
Schema design and modification impact on Apex development 52
Visualizing and creating entity relationships 53
Creating objects and fields with Schema Builder 55
Modifying page layouts through the App Builder 61
Adding and moving fields on the layout 63
Adding and removing Related Lists to and from the page layout 65
Table of Contents
Updating records 68
Importing and exporting data into development environments 70
Importing data 71
Exporting data 74
Importing data through the Data Import Wizard 78
Exporting data through Data Export 84
Importing data through Data Loader 87
Exporting data through Data Loader 100
Summary 102
Quiz 103
Section 2: Logic, Process Automation, and the User
Interface
Chapter 3: Declarative Automation 107
Formula fields 108
Roll-up summary fields 113
Declarative process automation features – workflow and processes 119
Workflow rules 120
Process Builder 126
Declarative process automation features – approvals and flows 127
Approval processes 127
Creating the approval process 130
Activating the approval process 147
Visual Workflow 164
Testing the workflow 190
When to use declarative process automation features versus Apex 192
Which automation tool do you use? 192
A record needs approval 192
When a record has certain values or meets certain criteria 193
You need to capture input and then do something with that information 193
Summary 194
Quiz 194
Chapter 4: Apex Basics 198
What is a class and an instance? 199
Understanding the features of Apex 201
How to develop Apex 201
When should you use Apex? 203
The Developer Console 204
Exercise 1 – opening the Developer Console and looking around for
possibilities 204
Exercise 2 – creating a new class in the Developer Console 207
Executing the code 209
Understanding code and its execution 211
Apex variables, constants, and expressions 213
Apex data types 213
[ ii ]
Table of Contents
Constants 216
Expressions 216
Operators 216
Access modifiers 220
Private 221
Protected 221
Public 221
Global 221
Exercise – building a new class and defining a private access modifier 223
Apex control flow statements 224
Conditional statements 224
Switch 226
Loops 227
The do-while loop 227
The while loop 227
The for loop 228
Iterations 229
Iteration of a set or list 229
Iteration collections 230
Working with data in Salesforce 231
Selecting data with SOQL and SOSL 231
SOQL syntax 233
SELECT fieldList [subquery] [...] 233
FROM objectType[...] 234
[WHERE conditionExpression] 234
[GROUP BY {fieldGroupByList|ROLLUP (fieldSubtotalGroupByList)|CUBE
(fieldSubtotalGroupByList)} 234
[ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ] 235
[LIMIT numberOfRowsToReturn] 236
[OFFSET numberOfRowsToSkip] 236
Selecting records with dynamic parameters 237
Variable assignment 237
SOQL aggregate, optional clauses, and return 239
SOQL relationships 240
SOSL 248
FIND {SearchQuery} 248
[ IN SearchGroup ] 249
[ RETURNING FieldSpec [[ toLabel(fields)] [convertCurrency(Amount)]
[FORMAT()]] ] 249
[ LIMIT n ] 249
DML statements 252
Different types of DML statements 252
Which type of DML should I use? 253
Methods of DML 254
Inserting records 255
Transaction control 257
Updating records 259
Upserting records 262
Exercise 264
Deleting and undeleting records 267
Merging records 269
[ iii ]
Table of Contents
Summary 271
Quiz 272
Chapter 5: Apex - Beyond the Basics 275
Apex classes and interfaces 275
Interfaces 276
Virtual and abstract classes 278
Abstract classes 278
Inheritance from abstract classes 281
Virtual classes 284
Annotations 287
Object schema 289
getGlobalDescribe() 289
Object description 290
Field description 291
Apex triggers 293
Trigger syntax 295
Trigger variables 300
Trigger.isExecuting 300
Trigger.isInsert 301
Trigger.isUpdate 301
Trigger.isDelete 301
Trigger.isUndelete 301
Trigger.isBefore 301
Trigger.isAfter 302
Trigger.new 302
Trigger.newMap 302
Trigger.old 303
Trigger.oldMap 303
Trigger.size 303
Governor limits 303
Per-transaction limits 304
Per-transaction managed package limits 305
Lightning Platform limits 305
Static Apex Limits 306
Size-specific limits 306
Miscellaneous Apex limits 306
An Apex trigger pattern for efficient data processing 307
Best practices 307
Trigger design patterns 310
Web service calls in triggers 311
@future 311
Queueable interface 312
The order of execution 314
Exception handling 318
Custom exceptions 319
Exception class 320
Security in Apex 321
[ iv ]