Salesforce Platform Developer I Certification Guide: Expert tips, techniques, and mock tests for the Platform Developer I (DEV501) certification exam
By Jan Vandevelde and Gunther Roskams
()
Salesforce
Programming
Salesforce Development
Object-Oriented Programming
Apex
Star-Crossed Lovers
Love Triangle
Quest
Mentor
Sacrifice
Chosen One
Secret Heir
Evil Overlord
Rebellion
Love Transcends Time
Lightning Components
Workflow Rules
Apex Triggers
Visualforce Pages
Apex Classes
About this ebook
Build and deploy scalable applications on the Salesforce Lightning Platform using the latest features of Spring '19
Key Features- An end-to end-guide with practice tests to help you achieve the Salesforce Platform Developer certification
- Design data models, user interfaces, and business logic for your custom applications
- Understand the complete development life cycle from designing to testing
Salesforce Lightning Platform, used to build enterprise apps, is being increasingly adopted by admins, business analysts, consultants, architects, and especially developers. With this Salesforce certification, you'll be able to enhance your development skills and become a valuable member of your organization.
This certification guide is designed to be completely aligned with the official exam study guide for the latest Salesforce Certified Platform Developer I release and includes updates from Spring '19. Starting with Salesforce fundamentals and performing data modeling and management, you’ll progress to automating logic and processes and working on user interfaces with Salesforce components. Finally, you'll learn how to work with testing frameworks, perform debugging, and deploy metadata, and get to grips with useful tips and tricks. Each chapter concludes with sample questions that are commonly found in the exam, and the book wraps up with mock tests to help you prepare for the DEV501 certification exam.
By the end of the book, you’ll be ready to take the exam and earn your Salesforce Certified Platform Developer I certification.
What you will learn- Solve sample questions and mock tests and work with exam patterns
- Gain an understanding of declarative Salesforce tools such as Process Builder, flows, and many more
- Code in Salesforce using the Developer Console and IDEs
- Grasp the basics of object-oriented programming
- Write Apex classes, Visualforce pages, and Apex test classes with easy-to-follow steps
- Explore the different deployment tools that you can use to push metadata to different environments
- Build custom declarative apps and programs on Force.com platforms
The Salesforce Platform Developer I Certification Guide is for you if you want to learn how to develop and deploy business logic and user interfaces using the capabilities of the Lightning Platform. No prior knowledge of Apex programming is required.
Related to Salesforce Platform Developer I Certification Guide
Related ebooks
Learning Apex Programming Rating: 5 out of 5 stars5/5Apex Design Patterns Rating: 4 out of 5 stars4/5Salesforce Essentials for Administrators Rating: 4 out of 5 stars4/5Mastering Application Development with Force.com Rating: 4 out of 5 stars4/5Salesforce Architect's Handbook: A Comprehensive End-to-End Solutions Guide Rating: 0 out of 5 stars0 ratingsSalesforce Platform App Builder Certification: A Practical Study Guide Rating: 0 out of 5 stars0 ratingsImplementing Azure Solutions Rating: 0 out of 5 stars0 ratingsImplementing Cloud Design Patterns for AWS Rating: 0 out of 5 stars0 ratingsPractical Salesforce Development Without Code: Building Declarative Solutions on the Salesforce Platform Rating: 0 out of 5 stars0 ratingsSalesforce Advanced Administrator Certification Guide: Become a Certified Advanced Salesforce Administrator with this exam guide Rating: 0 out of 5 stars0 ratingsSalesforce Certification: Earn Salesforce certifications and increase online sales real and unique practice tests included Kindle Rating: 0 out of 5 stars0 ratingsLearning Salesforce Development with Apex: Write, Run and Deploy Apex Code with Ease (English Rating: 0 out of 5 stars0 ratingsMastering Salesforce CRM Administration Rating: 5 out of 5 stars5/5Visualforce Development Cookbook Rating: 0 out of 5 stars0 ratingsSalesforce.com Interview Q & A & Certification Question Bank with Answers Rating: 4 out of 5 stars4/5Salesforce CRM - The Definitive Admin Handbook - Fourth Edition Rating: 5 out of 5 stars5/5Learning Salesforce Visual Workflow and Process Builder - Second Edition Rating: 4 out of 5 stars4/5Salesforce CRM Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsForce.com Enterprise Architecture Rating: 5 out of 5 stars5/5Salesforce CRM Admin Cookbook Rating: 4 out of 5 stars4/5Salesforce.com For Dummies Rating: 3 out of 5 stars3/5Learning Salesforce Einstein Rating: 0 out of 5 stars0 ratingsSalesforce CRM: The Definitive Admin Handbook Rating: 4 out of 5 stars4/5Learning Salesforce Visual Workflow Rating: 4 out of 5 stars4/5Force.com Enterprise Architecture - Second Edition Rating: 1 out of 5 stars1/5
Enterprise Applications For You
QuickBooks 2023 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsBitcoin For Dummies Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Access 2019 For Dummies Rating: 0 out of 5 stars0 ratingsQuickBooks 2024 All-in-One For Dummies Rating: 0 out of 5 stars0 ratings102 Useful Excel 365 Functions: Excel 365 Essentials, #3 Rating: 0 out of 5 stars0 ratingsExcel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsQuickBooks Online For Dummies Rating: 0 out of 5 stars0 ratingsCreating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Excel Workbook For Dummies Rating: 4 out of 5 stars4/5Excel Formulas That Automate Tasks You No Longer Have Time For Rating: 5 out of 5 stars5/5Managing Humans: Biting and Humorous Tales of a Software Engineering Manager Rating: 4 out of 5 stars4/5Learning Python Rating: 5 out of 5 stars5/5M Is for (Data) Monkey: A Guide to the M Language in Excel Power Query Rating: 4 out of 5 stars4/5Excel Formulas and Functions 2020: Excel Academy, #1 Rating: 4 out of 5 stars4/5Excel Tables: A Complete Guide for Creating, Using and Automating Lists and Tables Rating: 5 out of 5 stars5/5Mastering Excel: Starter Set Rating: 2 out of 5 stars2/5Excel All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsQuickBooks 2021 For Dummies Rating: 0 out of 5 stars0 ratingsExcel Tips and Tricks Rating: 0 out of 5 stars0 ratingsEnterprise AI For Dummies Rating: 3 out of 5 stars3/550 Useful Excel Functions: Excel Essentials, #3 Rating: 5 out of 5 stars5/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5
Reviews for Salesforce Platform Developer I Certification Guide
0 ratings0 reviews
Book preview
Salesforce Platform Developer I Certification Guide - Jan Vandevelde
Salesforce 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 [email protected] 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
Title Page
Copyright and Credits
Salesforce Platform Developer I Certification Guide
About Packt
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Code in Action
Conventions used
Get in touch
Reviews
Section 1: Fundamentals, Data Modeling, and Management
Salesforce Fundamentals
Considerations when developing in a multi-tenant environment
What is multi-tenancy?
The MVC paradigm
The core CRM objects
Leads
Accounts
Contacts
Opportunities
Extending an application's capabilities using AppExchange
Common use cases for declarative customization
Objects and fields
Formula fields
Rollup summary fields
Validation rules
WFR
Approval processes
The Process Builder
Lightning flow
Summary
Quiz
Understanding Data Modeling and Management
Data modeling
Creating an app
Creating custom objects and custom fields
Creating records
Relationship types
Creating relationships
Schema design and modification impact on Apex development
Visualizing and creating entity relationships
Creating objects and fields with Schema Builder
Modifying page layouts through the App Builder
Adding and moving fields on the layout
Adding and removing Related Lists to and from the page layout
Updating records
Importing and exporting data into development environments
Importing data
Exporting data
Importing data through the Data Import Wizard
Exporting data through Data Export
Importing data through Data Loader
Exporting data through Data Loader
Summary
Quiz
Section 2: Logic, Process Automation, and the User Interface
Declarative Automation
Formula fields
Roll-up summary fields
Declarative process automation features – workflow and processes
Workflow rules
Process Builder
Declarative process automation features – approvals and flows
Approval processes
Creating the approval process
Activating the approval process
Visual Workflow
Testing the workflow
When to use declarative process automation features versus Apex
Which automation tool do you use?
A record needs approval
When a record has certain values or meets certain criteria
You need to capture input and then do something with that information
Summary
Quiz
Apex Basics
What is a class and an instance?
Understanding the features of Apex
How to develop Apex
When should you use Apex?
The Developer Console
Exercise 1 – opening the Developer Console and looking around for possibilities
Exercise 2 – creating a new class in the Developer Console
Executing the code
Understanding code and its execution
Apex variables, constants, and expressions
Apex data types
Constants
Expressions
Operators
Access modifiers
Private
Protected
Public
Global
Exercise – building a new class and defining a private access modifier
Apex control flow statements
Conditional statements
Switch
Loops
The do-while loop
The while loop
The for loop
Iterations
Iteration of a set or list
Iteration collections
Working with data in Salesforce
Selecting data with SOQL and SOSL
SOQL syntax
SELECT fieldList [subquery] [...]
FROM objectType[...]
[WHERE conditionExpression]
[GROUP BY {fieldGroupByList|ROLLUP (fieldSubtotalGroupByList)|CUBE (fieldSubtotalGroupByList)}
[ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ]
[LIMIT numberOfRowsToReturn]
[OFFSET numberOfRowsToSkip]
Selecting records with dynamic parameters
Variable assignment
SOQL aggregate, optional clauses, and return
SOQL relationships
SOSL
FIND {SearchQuery}
[ IN SearchGroup ]
[ RETURNING FieldSpec [[ toLabel(fields)] [convertCurrency(Amount)] [FORMAT()]] ]
[ LIMIT n ]
DML statements
Different types of DML statements
Which type of DML should I use?
Methods of DML
Inserting records
Transaction control
Updating records
Upserting records
Exercise
Deleting and undeleting records
Merging records
Summary
Quiz
Apex - Beyond the Basics
Apex classes and interfaces
Interfaces
Virtual and abstract classes
Abstract classes
Inheritance from abstract classes
Virtual classes
Annotations
Object schema
getGlobalDescribe()
Object description
Field description
Apex triggers
Trigger syntax
Trigger variables
Trigger.isExecuting
Trigger.isInsert
Trigger.isUpdate
Trigger.isDelete
Trigger.isUndelete
Trigger.isBefore
Trigger.isAfter
Trigger.new
Trigger.newMap
Trigger.old
Trigger.oldMap
Trigger.size
Governor limits
Per-transaction limits
Per-transaction managed package limits
Lightning Platform limits
Static Apex Limits
Size-specific limits
Miscellaneous Apex limits
An Apex trigger pattern for efficient data processing
Best practices
Trigger design patterns
Web service calls in triggers
@future
Queueable interface
The order of execution
Exception handling
Custom exceptions
Exception class
Security in Apex
DML security
Field-level security
SOQL injection
Use bind variables
Escape SingleQuotes
Replacing characters
Whitelisting
Record security – with and without sharing
Web service callouts
The endpoint
The HTTP request
Exercise
Summary
Quiz
The Salesforce User Interface
Introduction
Displaying Salesforce data using Visualforce
Where is this used?
Visualforce language
Creating Visualforce pages
Standard controllers
Exercise
Standard list controllers
Controller extensions
Working of a controller extension
Custom controller
Controller methods
Action methods
Getter actions
Setter methods
Validation rules and custom controllers
Web content in Visualforce
Static resources
Incorporating Visualforce pages into Force.com
Force.com sites
Configuration of a site
Lightning Component framework
My Domain
Benefits of the Lightning Component framework
Resources in a Lightning component
Component attributes
Expressions
Value providers
The component
The renderer
The Helper
The client-side controller
Server-side controller
Summary
Quiz
Section 3: Testing, Debugging, and Exercise
Testing in Salesforce
Testing deployment requirements and the testing framework
The importance of testing
The four principles of a good testing approach
Creating test data from scratch
Performing your test scenario
Be assert-ive!
Breaking things
Be bulkyfied!
Other stuff
Writing Apex unit tests
Setting up test data
@TestSetup
Mixed Data Manipulation Language (DML) operations
Creating a unit test
The test data
The test scenario
What’s the result of the test?
Executing test classes
Testing web service callouts
Callout types
WSDL2Apex
HttpCalloutMock
Invoking Apex to execute anonymously versus unit tests
Test functions
The impact on code during declarative changes
Summary
Quiz
Debugging and Deployment Tools
Monitoring and accessing debug logs
What is a debug log?
Working with the Developer Console, Workbench, and Force.com IDE platforms
Developer Console
Workbench
The Force.com IDE
Salesforce environments
Deploying metadata to another org
Deploying metadata with change sets
Deploying metadata through unmanaged packages
Deploying metadata through an IDE
Remember the following about deployments
Summary
Quiz
Mock Tests
Mock exam
Appendix
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Code solutions
Code solution – DML update statement with Database.update statement
Code solution for upserting records
Code solution – API connection to the Person object
Visualforce page – AddNewMovie
The MovieExtension test class – setting up test data
Executing unit tests – example of a bad scenario
Other Books You May Enjoy
Leave a review - let other readers know what you think
Preface
First of all, now is a great time to become a Salesforce developer. Salesforce and the Lightning Platform are booming all over the world. There is a huge demand for Salesforce professionals such as admins, business analysts, consultants, architects, and especially developers. The demand for developers has never been higher than now (not only in the Salesforce ecosphere)!
So, if you combine the high demand for Salesforce professionals and the huge demand for developers, the potential for job security increases and there should always be a place for you to work at.
This book will help you become a certified Salesforce developer, even if you have no prior programming knowledge!
Who this book is for
Do you want to pass Salesforce Platform Developer I certification? Then this book is for you! This book is for anyone who wants to know all about the powerful Salesforce Platform, ranging from the declarative tools and features at your disposal to the coding side, to extend the standard capabilities and go beyond the limits. This book will prepare you for the actual exam and assumes you have no prior programming knowledge whatsoever. Having Java knowledge is a plus, but is not necessary, as I will be explaining Apex from the ground up. Platform Developer I is one of the pre-requisites of the architect track; for both Application Architect and Systems Architect, you are required to pass this exam. This is also one of the most dreaded exams for Salesforce admins and functional consultants, as they think they won't be able to learn how to code. I'm living proof that this is perfectly possible. Coming from no programming background, I've learned to code in Apex over the years and now hold 15 certifications, including Application and Systems Architect. Something that, a couple of years ago, I would never have imagined, due to my lack of coding knowledge. With this in mind, I wrote this book. I have been there, so I have tried to explain the core concepts in the most simple ways possible, so anyone would be able to understand them.
What this book covers
Chapter 1, Salesforce Fundamentals, teaches you about Salesforce Platform in general, and how Salesforce can be used by companies to support their day-to-day business processes for sales, services, marketing, field services, finance, IT, HR, and in other departments.
Chapter 2, Understanding Data Modeling and Management, teaches you how to start customizing Salesforce Platform to fit your business needs; how to use the standard objects, create custom objects, and add fields to capture data specific to your business and create relationships between those objects to create a 360° view.
Chapter 3, Declarative Automation, shows you the different tools that are available within the platform, such as workflow rules, Process Builder, and Flow, to automate processes such as updating the values of fields, creating automated tasks, sending out emails internally and externally, and even creating and updating records based upon specific user actions.
Chapter 4, Apex Basics, explains the Apex programming language. What is it? When is it used? You will learn the basic syntax so you can read and understand how logic is executed on the platform. On top of that, you'll learn how to write it yourself and create your own custom logic from scratch.
Chapter 5, Apex - Beyond the Basics, goes over some more advanced concepts of Apex, such as web service callouts and trigger frameworks.
Chapter 6, The Salesforce User Interface, teaches you how you can create your own visual interfaces on the platform by using Visualforce pages, Visualforce components, and Lightning components. Salesforce gives you lots of declarative features to modify the look and feel of your user interface, but you never know when you'll come across a requirement for which those are just not enough.
Chapter 7, Testing in Salesforce, is a very important chapter because you may have created the most beautiful Visualforce pages with excellent custom logic in your sandbox, but you won't be able to deploy them to your production environment unless you have tested whether all your customizations behave as you would expect. This chapter teaches you the principles of testing your code, making sure you get the expected results, and making your custom logic ready for deployment to another environment.
Chapter 8, Debugging and Deployment Tools, focuses on the different development tools available to you as a developer. While creating your custom logic, you will most probably encounter errors. This chapter teaches you how to debug those errors and how to solve them so your code runs smoothly. In this final chapter, we also cover different methods for deploying your custom application to another unrelated environment.
Chapter 9, Mock Tests, gives you the chance to test yourself. This exam is a representation of what the real Salesforce Platform I certification exam is like. It does not contain the actual questions, but very similar ones. This is meant to give you a feel of what type of questions will be asked, and how many per topic. Score above 80% on this mock exam and you will most likely pass the real exam.
To get the most out of this book
We advise you to not only read the book but actually practice all the exercises in the book. By creating a developer environment and following the steps in every chapter, you will be able to better remember the content, as you will be able to see it right before your eyes. It has been proven that you learn far better by doing rather than just reading.
Every chapter also ends with some quiz questions to check whether you have grasped the content explained in each chapter.
In the Appendix, you'll find all the solutions to the quiz questions from every chapter and also the answers for the mock exam.
All the necessary instructions are provided in the respective chapters.
This book will comprise of over five hours of video tutorials.
Download the example code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at www.packt.com.
Select the SUPPORT tab.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Salesforce-Platform-Developer-I-Certification-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789802078_ColorImages.pdf.
Code in Action
Visit the following link to check out videos of the code being run: http://bit.ly/30Fg4LY.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: The Lightning Component framework can only call methods that have the @AuraEnabled annotation.
A block of code is set as follows:
public Movie__c getMovie() {
if(this.movie == null){
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
closeModal: function(component, event, helper){
var navToMovieTab = $A.get(e.force:navigateToObjectHome
);
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: Click on the Controller link to write this part of your controller.
Warnings or important notes appear like this.
Tips and tricks appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.
Section 1: Fundamentals, Data Modeling, and Management
Before we learn how to develop on Salesforce Platform, we need to understand what the platform actually encompasses. We'll learn what the Salesforce Lightning Platform is, how businesses can leverage the multitude of features that come with it, and how it can support business processes. Once we have covered that, we'll learn about the core objects and relationships between objects that form the data model within the platform. We'll also learn how to create our own objects to tailor the platform to every business need.
The following chapters are included in this section:
Chapter 1, Salesforce Fundamentals
Chapter 2, Understanding Data Modeling and Management
Salesforce Fundamentals
Salesforce is a company, founded by Marc Benioff and Parker Harris in 1999, that specializes in software as a service (SaaS). Salesforce started by selling a cloud-based Customer Relationship Management (CRM) application, which laid the foundation for many of its future services and was built on the Salesforce Platform. Following this, the company began packaging other applications that were closely intertwined on the same platform and divided them into clouds. These cloud-based applications are now popularly known as Sales Cloud, Service Cloud, Marketing Cloud, IoT Cloud, Integration Cloud, Community Cloud, Health Cloud, and Financial Services Cloud, among others.
In this chapter, you will learn about the basic concepts of working on the Salesforce Platform. The material covered in this chapter represents 10% of the exam questions.
We'll learn about the following topics in this chapter:
What you need to consider when developing in a multi-tenant environment
The Model-View-Controller (MVC) paradigm
The core objects of the Salesforce Platform
How you can extend an application's capabilities
How you can solve some common use cases with declarative features
We'll end the chapter with a summary and a quiz so that you can check whether you understand everything that you need to for the exam.
Considerations when developing in a multi-tenant environment
We've briefly mentioned what Salesforce is in the introduction, but it's also important to know what the Lightning Platform is before we start talking about multi-tenancy. The Lightning Platform is the infrastructure in which companies can enable one or more of the aforementioned cloud products, install apps from the AppExchange (the Salesforce store), or build their own custom apps.
Using the platform alone—that is, without one of the core cloud products such as Sales Cloud or Service Cloud—is also possible through Salesforce's platform as a service (PaaS) option. In a similar way to their CRM application, customers can pay a monthly fee to access the shared resources and build custom apps through PaaS.
The biggest benefits of using or buying a cloud service product is that everything is taken care of by the provider – that is, the servers, storage space, the infrastructure, networks, security, backups, and upgrades.
Some characteristics of using cloud-based services are as follows:
They are subscription-based models
They have low startup fees
They have fixed and predictable costs (that is, you pay as you use the service)
They are scalable
They include regular, automated upgrades
They are multi-tenancy platforms; this means that multiple customers use (or share) the same instance
These are important features to bear in mind when talking about multi-tenancy!
What is multi-tenancy?
When I try to explain multi-tenancy to my customers, I always compare it to an apartment block.
For example, consider a scenario, where you – as a company or a customer – rent an apartment in a block that is owned by Salesforce, who is your landlord:
Here, your apartment has specific layouts and resources – that is, it has a number of rooms divided by walls. In addition to this, it has central heating, electricity, water, and more. To access and use this apartment, you pay a monthly rent, and everything else is taken care of for you and the other occupants in the building by your landlord.
Apart from your apartment (which is your private space), all the other resources are shared by the occupants of the building. This means that if Salesforce decides to upgrade the central heating to underfloor heating, then you will automatically benefit from this. You can see this as three releases (that is, upgrades containing new features and enhancements) a year, which Salesforce implements.
The preceding diagram represents the difference between buying a single house, which is yours (Single-Tenancy), and renting an apartment in a block with multiple apartments (Multi-Tenancy).
Within your apartment, you can design your interior just the way that you want, and adjust it to your needs and personal preference! For instance, you can choose what room to have as your bedroom or your kitchen; or, alternatively, you can use the whole apartment as an office space. You can even paint the walls blue or flashy green if you want to. This is similar to using a Salesforce Platform, where once you have access to your space, you can then create new custom objects, add fields, and automate features to suit your business needs.
The only thing that you can't do is break down the walls – otherwise, the whole building will collapse, right? Even though you have full flexibility in rearranging your apartment, you are still limited when it comes to certain things! For example, you can't put in a 5-meter sofa if the size of the room is smaller than this; additionally, you can't put in a Christmas tree that is higher than the height of your room, or you would need to break the ceiling, and your neighbor would start a lawsuit against you. Alternatively, you can't just install multiple high-voltage accessories or machines in your apartment without the electricity box exploding and leaving the whole building without power!
I use this analogy in order to explain the governor limits that Salesforce enforces. Salesforce enforces these limits to make sure that no one single occupant will consume resources that could impact the other tenants or occupants who are using the Salesforce infrastructure.
Salesforce uses a multi-tenancy architecture, meaning that a number of organizations (orgs) share the same IT resources, as opposed to dedicated resources. This results in a standard environment that is fully operated and managed by Salesforce, which is much more efficient and cost-effective for your company.
The self-contained unit that allows an org to run is called an instance; it contains everything that is needed to run an org:
An application and database server
A file server
A server, storage, and network infrastructure
An org is an independent configuration (or metadata) and data that is dedicated to a customer. It is represented by a unique ID that you can find in the Company Profile section in Setup. You must provide this ID each time you contact Salesforce support for Cases, Feature Request, and more. Each org only runs on one instance, which serves thousands of other orgs.
The org's unique ID is stored in every table in the shared database to allow the filtering of data, and to ensure that a client's data is only accessed by that client alone.
Some advantages of multi-tenancy are as follows:
All Salesforce customers, from small businesses to enterprise companies, are on the same code base and they all benefit from the same features and new functionality.
Salesforce upgrades are easy, automatic, and seamless. There are three automatic upgrades a year, which are called the Spring, Summer, and Winter releases.
With upgrades, a version is associated with every Apex trigger and Apex class. Here, backward compatibility is assured.
Each class has a version associated with it called the API version. When you move to the next release, the Apex class always uses the older version of the compiler to guarantee this backward compatibility. Otherwise, you can modify the code to work on the newest version.
So, if all resources are shared by multiple customers, how does Salesforce ensure that one customer doesn't eat up all resources or break things that could impact all other customers on the same instance?
Salesforce controls this by enforcing two things, which can be considered as the side effects of multi-tenancy:
Governor limits: These are the limits enforced by Salesforce that cannot be changed, and they are the same for anyone using the platform. For example, you can only use 100 queries in one execution context or perform 150 DML (short for Data Manipulation Language) statements in one execution context. Don't worry if you don't understand this yet, as we'll come back to this later. You can find the list of all the governor limits in the Salesforce documentation at https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm.
Mandatory testing: Salesforce forces you to test your code before you are allowed to deploy it to production or upload a package to the AppExchange. At least 75% of all code must be covered by tests and they should all pass. Every trigger within your deployment package needs at least some coverage. It's best practice to test all possible scenarios, including positive and negative tests, in addition to testing for bulk updates or creation.
The MVC paradigm
MVC is an architectural design pattern in modern software development that promotes the separation of an application into three components:
An application's data storage (model)
An application's user interface (view)
An application's logic (controller)
The following diagram maps Salesforce's components to this architectural design:
This architecture is used a lot in software development because the isolation of data (that is, the model), user interface (that is, the view), and logic (that is, the controller) allows each component to be developed, tested, and maintained independently.
Model: This is actually where your data is stored and can be used. To store data, you need objects or fields, and these are considered to be part of the model.
View: This is whatever end users see and interact with; that is, what displays data to the clients or customers. This allows you to control how (and what) data is shown on the user interface. So, standard pages, page layouts, Visualforce pages, Lightning components, console layouts, and mini page layouts are all considered part of the view.
Controller: This refers to the actual logic and actions that are executed when someone interacts with Visualforce pages, standard pages, or Lightning components. The controller is the link that binds the client side and the server side. It will mostly consist of Apex; this means that even when building Lightning components, you'll probably need Apex to get the data from the database on the server and pass it to the JavaScript controller. The new Lightning Data Service from Salesforce acts like a standard controller—it connects to objects and fields in the database without writing any Apex.
You could describe MVC like this—when you see a registration form (such as the Visualforce page developed on Salesforce), enter some information into the form, and then hit submit, the details are sent to a database and are saved into tables, columns, and rows (these are Salesforce objects and fields). Which data goes to what object and field in Salesforce is controlled by the logic defined in the standard and custom controllers.
The core CRM objects
I expect that this will be a recap for you; however, just to be sure, I would like to summarize the functionalities paired with some of the most popular core CRM objects. This is important, as a lot of questions in the exam will give you business scenarios around these objects, and before thinking about programmatic solutions, you should consider whether there is any declarative solution that comes out of the box that could be used to meet the requirement.
Leads
The lead object is mostly used for individuals and/or companies that have been identified as potential customers but have not been qualified yet. Leads can be created in several ways; you can create them manually one by one, by clicking on New in the Lead tab. They are usually imported from .csv files (and quite possibly bought by your marketing and/or sales department). Alternatively, they can be created automatically