Professional Documents
Culture Documents
A Run Sales Force Report
A Run Sales Force Report
A Run Sales Force Report
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
Submitted by
KAKANURU ARUN KUMAR REDDY
21121A3325
III B.Tech I Semester
1
SREE VIDYANIKETHAN ENGINEERING
COLLEGE
(AUTONOMOUS)
Sree Sainath Nagar, A. Rangampet
Certificate
This is to certify that the internship report entitled “Salesforce Developer Virtual
Internship” is the bonafide work done by KAKANURU ARUN KUMAR REDDY (Roll
fulfillment of the requirements for the award of the degree of Bachelor of Technology in
Head:
2
COMPLETION CERTIFICATE FROM COMPANY
3
ABSTRACT
Salesforce Developer online course is developed by Salesforce and
provided by SmartInternz which is designed for individuals who want to learn
everything there is to understand about Salesforce to become professional
salesforce developers. The Salesforce Developer online course by SmartInternz
focuses on covering basic Salesforce technology functionality utilizing several
programming languages. Salesforce Developer internship begin with the section
where individuals are taught about the Salesforce testing framework and frequent
use cases of Salesforce for logical against functional modifications. Individuals are
also taught how to use programmable strategies to minimize security flaws and
how to write classes and triggers in Apex. Individuals will get a comprehension of
many technologies in development, validation, and reporting modification by the
end of this training, and will be able to develop various data models or
architectures employing various techniques and automation. After completing the
Salesforce Developer course, individuals will develop a comprehensive
understanding of the Salesforce platform's fundamental capabilities for managing
business processes. Individuals will examine the Apex and Visualforce systems'
capabilities. Individuals will gain knowledge of data modeling, data security,
Apex triggers and classes, and validation methodologies, as well as Apex
integration services skills. Individuals will also learn how to logically customize
apps using formulas and validation rules, as well as build business process
models utilizing process builders and flows.
iv
ACKNOWLEDGEMENT
We are extremely thankful to our beloved Chairman and founder Dr. M. Mohan
Babu who took keen interest to provide us the oppurtunity for carrying out the project work.
We are very much obliged to Dr. B. Narendra Kumar Rao, Professor & Head,
Department of CSE, for providing us the guidance and encouragement in completion of this
work.
I would like to express my special thanks of gratitude to the Smartinternz , who gave me the
golden opportunity to do this wonderful internship, which also helped me in doing a lot of
Research and I came to know about so many new things I am really thankful to them.
v
TABLE OF CONTENTS
Title Page no
Abstract .. iv
Acknowledgements .. v
List of Tables .. vii
List of Figures .. viii
Chapter 1: Introduction
1.1 Quick introduction to salesforce .. 01
1.2 Stories of Salesforce .. 02
1.3 Important terms .. 02-03
Chapter 2: Salesforce Org
2.1 Customize the Salesforce Platform .. 04
2.2 Use cases of the Platform .. 04-06
Chapter 3: Relationship and Process Automation
3.1 Customize the Salesforce Object .. 07-09
3.2 Data Modelling .. 09-11
3.3 Picklist Administration .. 11-13
3.4 Duplicate Management .. 13-14
3.5 Formulas and Validation .. 14
3.6 Lighting App builder .. 15
Chapter 4: Types of Flows & Security
4.1 Flow Builder .. 16
4.2 Data Security .. 17-19
Chapter 5: Apex & Testing, Debugging
5.1 Apex Triggers
.. 20-21
5.2 Apex Testing
.. 21-22
5.3 Asynchronous apex
.. 2-24
Chapter 6: Case Study
6.1 Apex specialist Badges .. 25-28
6.2 Process Automation Badges .. 28-30
Conclusions .. 31
References .. 32
vi
LIST OF TABLES
vii
LIST OF FIGURES
viii
Chapter 1
Introduction
You might think that Salesforce is just a CRM. It stores your customer data, gives you processes to
nurture prospective customers, and provides ways to collaborate with people you work with. And it
does all those things. But saying that Salesforce is “just a CRM” is like saying a house is just a
kitchen. There’s a lot more to it than that.
Depending on what your company purchases, you can get these features and more without lifting a
finger. But you can almost think of these features as a model house that a real estate agent shows
off. You could certainly live there, but it wouldn’t be your home. It wouldn’t have your art on the
wall or that unusual coat rack your Aunt Tilda gave you as a housewarming gift.
That’s where the Salesforce platform comes in. With the platform, you can customize and
build whatever it is that makes your company unique. And when you have a business application
that’s unique to you, everyone is more successful.
1
Salesforce is the CRM (Customer Relationship Management) where it unites Marketing,
Sales, Commerce, IT etc teams to their customers to deliver a better service. This internship is
determined to teach this emerging Technology in a very realistic and fun way. They have organized
the challenges in such a way that the learner will be able to learn salesforce in a very enthusiastic
and fun way with a limited time participation.
This Internship consists of live sessions, Hands-on practical activities, mentoring support
and working on super badges on Trailhead platform. In order to help all beginners, understand the
salesforce ecosystem and its products, we have curated a few best modules on the trailhead platform
that will help you to get ready for the Bootcamp.
There are lot of companies and characters that are using Salesforce in different ways. Let’s meet
some of the players.
1. Cloud Kicks—This custom sneaker company is making waves in the footwear industry. They use
Salesforce to manage sales and help streamline their complicated order creation and fulfilment
process.
2. Ursa Major Solar—On the cutting edge of renewable energy, Ursa Major Solar needs business
software that doesn’t shy away from ground breaking technology. They use Salesforce to manage
sales and customer service nationwide.
3. Get Cloudy Consulting—As one of the best cloud consulting firms in the business, Get Cloudy
knows CRM. They use Salesforce to manage existing and potential clients, and they’re always
looking for new ways to innovate with Salesforce services.
4. DreamHouse Realty—Known for their fresh approach to real estate, Dreamhouse uses Salesforce
to connect their employees and improve the efficiency of home sales.
First, it’s important to understand what a database is in the context of Salesforce. When we
talk about the database, think of a giant spreadsheet. When you put information into Salesforce, it
gets stored in the database so you can access it again later. It’s stored in a very specific way so you
are accessing the information you need.
2
An app in Salesforce is a set of objects, fields, and other functionality that supports a
business process. You can see which app you’re using and switch between apps using the
App Launcher.
.Objects are tables in the Salesforce database that store a particular kind of information.
There are standard objects like Accounts and Contacts and custom objects like the Property
object.
.Records are rows in object database tables. Records are the actual data associated with an
object.
Fields are columns in object database tables. Both standard and custom objects have fields.
Org is short for organization, and it refers to a specific instance of Salesforce.
3
Chapter 2
Salesforce Org
2.1 Customize the salesforce Platform
The Salesforce platform is used to develop custom objects and functionality specific to your
business. We can do most of this development without ever writing a line of code. Developing
without code is known as no-code (or declarative) development. With no-code development, we use
forms and drag-and-drop tools to perform powerful customization tasks. The platform also offers
programmatic development, which uses things like Lightning components. But if you’re not a
programmer, you can still build some amazing things on the platform. Let’s see how to create a
salesforce platform.
From the gear icon, click Setup to launch the setup page.
HR User Platform
HR has hundreds of applications coming in for dozens of job openings. Once applicants are
hired, has HR to set up training and submit hardware requests. All this activity creates a lot of data,
and HR will be struggling to manage it all.
Using the Salesforce platform, HR can create a custom app that helps DreamHouse HR
employees streamline and automate the hiring and onboarding process. Here are some things the
custom app can do.
4
Store applicants for each job opening.
Send automated reminders to hiring managers.
Store orientation and training plans.
Manage equipment orders.
Track employee time off.
List job openings.
Like any app built on the platform, the HR app creates is available for the Salesforce mobile app.
That way, HR can manage applicants and new hires whether reps are in the office or off at a
recruiting fair.
IT manager getting a million IT tickets coming in every minute and everyone’s problems seem
to be urgent. When we build our IT ticketing system in the same place as our CRM, we get a lot of
benefits. All the users and their information are already there. Manager can track cases per user and
promote collaboration between IT and employees. Here are some other ways to streamline IT using
the Salesforce platform:
With a streamlined IT process, users are happier and IT has more time to build infrastructure rather
than maintain a separate system.
By now, we are probably getting some ideas for projects of our own. Here are a few use cases for
different departments
5
Table 2.1 Intern User Platform
6
Chapter 3
AW Computing has established a Salesforce environment with users set up, profiles
assigned, and access to records and fields configured. But they’re in need of further customization
to ensure users have the necessary fields to capture the business information they need. That’s
where we, the admins, come in.
To begin with, you have a request from Head of Sales Operations Yuko Ishikawa. Yuko
says her Sales Op team uses the Account Rating field for sales prospecting, but they’re concerned
that account owners aren’t capturing this information correctly because they don’t understand what
the field is for. To help her team use the field properly and capture all the data they need, change the
name of the field, provide guidance on how to use it, add an additional value, and restrict who can
edit it.
Before you get to those tasks, create profiles for members of the sales and support teams.
7
Click save.
Now add help text to the field, add a new value to the Account Rating Picklist, and update
field-level security.
Description Sales users use this field to indicate to Support which customers have
support plans.
Help Text Does this customer have a current support plan? Check this box
when you sell a support plan to this customer.
Click Next.
Select the checkbox in the Read-Only column header.
Deselect the Sales User and Support User checkboxes in the Read-Only column.
Click Next then Save & New.
Next create a Support Expiration Date field, editable by sales and support users only.
8
Select Date as the Data Type, then click Next and fill in the details.
Field Value
DreamHouse is a realty company that provides a way for customers to shop for homes and
contact real estate agents online. DreamHouse brokers use some of Salesforce’s standard
functionality, like contacts and leads, to track home buyers. But when it comes to selling houses,
there are a lot more things they want to track. For example, Salesforce doesn’t include a standard
way to track properties. How is DreamHouse supposed to know which homes they have for sale or
how much each home costs? Luckily, the Salesforce admin, D’Angelo, knows that the Salesforce
platform offers a solution. We’ll work with D’Angelo to see what he’s building.
Let’s start with the data model. A data model is more or less what it sounds like. It’s a way
to model what database tables look like in a way that makes sense to humans. If you’re not familiar
with databases, think about storing data in a spreadsheet. For example, D’Angelo can use a
spreadsheet to track all DreamHouse’s properties.
Columns can store the address, cost, and other important attributes. Rows can store this
information for each property that DreamHouse is selling. Database tables are set up in a similar
way. In Salesforce, we think about database tables as objects, we think about columns as fields, and
rows as records. So instead of an account spreadsheet or table, we have an Account object with
fields and a bunch of identically structured records.
Salesforce supports several different types of objects. There are standard objects, custom
objects, external objects, platform events, and Big Objects. In this module, we focus on the two
9
most common types of objects: standard and custom. Standard objects are objects that are included
with Salesforce. Common business objects like Account, Contact, Lead, and Opportunity are all
standard objects.
Custom objects are objects that you create to store information that’s specific to your
company or industry. For DreamHouse, D’Angelo wants to build a custom Property object that
stores information about the homes his company is selling. Objects are containers for your
information, but they also give you special functionality. For example, when you create a custom
object, the platform automatically builds things like the page layout for the user interface.[1]
There are two main types of object relationships: lookup and master-detail.
Lookup Relationships
In our Account to Contact example above, the relationship between the two objects is a lookup
relationship. A lookup relationship essentially links two objects together so that you can “look up”
one object from the related items on another object. Lookup relationships can be one-to-one or one-
to-many.
The Account to Contact relationship is one-to-many because a single account can have many
related contacts. For our DreamHouse scenario, you could create a one-to-one relationship between
the Property object and a Home Seller object.
Master-Detail Relationships
While lookup relationships are fairly casual, master-detail relationships are a bit tighter. In this
type of relationship, one object is the master and another is the detail. The master object controls
certain behaviour of the detail object, like who can view the detail’s data. For example, let’s say the
owner of a property wanted to take their home off the market. DreamHouse wouldn’t want to keep
any offers made on that property. With a master-detail relationship between Property and Offer, you
can delete the property and all its associated offers from your system.
Schema Builder is a tool that lets you visualize and edit your data model. It is used for
designing and understanding complex data model.
10
.
Picklists offer a selection of options available for specific fields in a Salesforce object, such as a list
of regions.
11
Create a global value set. A global value set is a custom set of values you create to share
with more than one picklist field.
Standard picklist fields sometimes share a standard value set. For example, on the Lead
object, the Lead Source picklist values are part of a standard value set. The same values are
also used on the Account object for the Account Source picklist field. When you change a
value from that set in the Lead Source picklist settings, the change also appears in the
Account Source picklist field values.
3.3.2 Custom Picklist
In Setup, click the Object Manager tab, and then select the object to contain the picklist field.
12
values in the field, later. However, when you convert a multi-select picklist to a picklist field
that doesn’t support multi-select, Salesforce clears the values for that field on existing
records. The new field only allows one value. Reports referencing multi-select picklists
should use contains or includes (not equals) to collect all results that contain more than one
value.[4]
When your sales reps work with duplicate-free data, there’s no guessing about whether a
colleague is already qualifying the same prospect. Also, your reps can count on having all
information in one contact record, instead of hunting for more details in a duplicate record.
It’s important that your sales teams feel confident that you’re managing Salesforce and delivering
features with your teams’ trust and success in mind. When your CRM system is free of duplicate
data, your reps trust that the data is clean and worthwhile.
We’ve covered some of the problems that duplicate data creates for your company. Salesforce
helps your reps handle the duplicate records—from any device. And we give you options to prevent
or discourage your sales reps from creating more duplicate records with Duplicate Management. It’s
available to and free of charge for Professional, Enterprise, and Unlimited editions.
Duplicate Management helps you and your sales teams quickly and easily manage duplicates
for:
Business accounts
Contacts
Leads
Person accounts
Records created from custom objects
It’s highly configurable, and offers you far more than just exact detection and matching logic. Our
standard matching detects potential duplicate records based on exact matches, such as two contacts
with the same name, Margaret Chan.
13
But you can set up a rule to include fuzzy matching, which identifies potential duplicate records
based on variances of certain fields. For example, you create a rule to include fuzzy matching for
first names. Duplicate Management identifies the two contacts Margaret Chan and Maggie Chan as
potential duplicate records.[2]
Users need to access and understand this data at a glance without doing a bunch of calculations in
their heads. Enter formula fields, the powerful tool that gives you control of how your data is
displayed.
If you wanted to take two numeric fields on a record and divide them to create a percentage.
Or perhaps you want to turn a field into a clickable hyperlink for easy access to important
information from a record’s page layout. Maybe you want to take two dates and calculate the
number of days between them. All these things and more are possible using formula fields.
Let’s look at a specific example. What if you wanted to calculate how many days are left
until an opportunity’s close date? You can create a simple formula field that automatically
calculates that value. By adding the value to the Opportunity page layout, your users can quickly
access this key information. You can also add this field to reports and list views for instant access.
Validation rules verify that data entered by users in records meets the standards you specify
before they can save it. A validation rule can contain a formula or expression that evaluates the data
in one or more fields and returns a value of “True” or “False.” When the validation rule returns a
value of "True", this confirms that the data entered by the user contains an invalid value.
Validation rules can also include error messages to display to users when they enter invalid
values based on specified criteria. Using these rules effectively contributes to quality data. For
example, you can ensure that all phone number fields contain a specified format or that discounts
applied to certain products never exceed a defined percentage. You can create validation rules for
objects, fields, campaign members, or case milestones. In these steps, we create a validation rule
that fires when a user tries to save an account with an account number of incorrect length.[3]
14
3.6 Light App Builder
The users are busy. They’re closing deals, providing top-notch service, and marketing to
your prospects and customers. By creating customized pages, you can put key information at your
users’ fingertips and provide them with an easy interface to update and add records. The Lightning
App Builder is a point-and-click tool that makes it easy to create custom pages for the Salesforce
mobile app and Lightning Experience, giving your users what they need all in one place. But that’s
not all. When you edit a Lightning app from the App Manager in Setup, you’re brought into the
Lightning App Builder to manage the app’s settings. You can update the app’s branding, navigation,
options, and manage the Lightning pages assigned to that app all in the Lightning App Builder.
A Lightning page is a custom layout that lets you design pages for use in the Salesforce mobile app
or Lightning Experience. A Lightning page is composed of regions that contain components. The
structure of a Lightning page adapts for the device it’s viewed on. The template you choose when
creating the page controls how it displays on a given device. The Lightning page’s template divides
the page into regions. A Lightning component is a compact, configurable, and reusable element
that you can add to a Lightning page in the Lightning App Builder.[5]
15
Chapter 4
Type of Flows and Security
In flows, resources are placeholders similar to merge fields in an email template or a formula. Let's
say you start an email with Hi, {!$ User.FirstName}.{!$User.FirstName} is a placeholder, so when
the email is sent, it displays the actual first name of the user. In each step of the flow (the elements
added to the canvas), you can reference flow resources instead of manually entering values.
Most standard input components request a value like a number or a paragraph of text. For Radio
Buttons, Picklist, Checkbox Group, and Multi-Select Picklist components, the user instead chooses
from a set of options. To identify the available options, select at least one choice or choice set
resource.
A record choice set generates multiple options by using a filtered list of records.
A picklist choice set generates multiple options by using the values of a picklist or multi-select
picklist field.
A choice represents a single option with the label and value set manually.[6]
16
4.2 Data Security
Choosing the data set each user or group of users can see is one of the key decisions that
affects the security of your Salesforce org or app. Once you’ve designed and implemented your data
model, give some thought to the kinds of things your users are doing and the data they need to do it.
If you haven't completed the Data Modeling module, go ahead and earn that badge before
continuing with this module.
Let’s say you’re building a recruiting app to help manage open positions, candidates, and
job applications. You’ll have to store confidential data, such as social security numbers, salary
amounts, and applicant reviews, that only some types of users should see. You’ll want to secure the
sensitive data without making life harder for recruiters, hiring managers, and interviewers.
With the Salesforce platform’s flexible, layered sharing model, it’s easy to assign different
data sets to different sets of users. You can balance security and convenience, reduce the risk of
stolen or misused data, and still make sure all users can easily get the data they need.
The platform makes it easy to specify which users can view, create, edit, or delete any
record or field in the app. You can control access to your whole org, a specific object, a specific
field, or even an individual record. By combining security controls at different levels, you can
provide just the right level of data access to thousands of users without having to specify
permissions for each user individually.
You can control which users have access to which data in your whole org, a specific object, a
specific field, or an individual record.
Organization: For your whole org, you can maintain a list of authorized users, set password
policies, and limit logins to certain hours and locations.
Objects: Access to object-level data is the simplest thing to control. By setting permissions on a
particular type of object, you can prevent a group of users from creating, viewing, editing, or
deleting any records of that object. For example, you can use object permissions to ensure that
interviewers can view positions and job applications but not edit or delete them. You can use
profiles to manage the objects that users can access and the permissions they have for each object.
You can also use permission sets and permission set groups to extend access and permissions
without modifying users' profiles.
17
Fields: You can restrict access to certain fields, even if a user has access to the object. For example,
you can make the salary field in a position object invisible to interviewers but visible to hiring
managers and recruiters.
Records: You can allow particular users to view an object, but then restrict the individual object
records they're allowed to see. For example, an interviewer can see and edit her own reviews, but
not the reviews of other interviewers. You can manage record-level access in these four ways.
Organization-wide defaults specify the default level of access users have to each other’s’
records. You use org-wide sharing settings to lock down your data to the most restrictive
level, and then use the other record-level security and sharing tools to selectively give access
to other users.
Role hierarchies give access for users higher in the hierarchy to all records owned by users
below them in the hierarchy. Role hierarchies don’t have to match your organization chart
exactly. Instead, each role in the hierarchy should represent a level of data access that a user
or group of users needs.
Sharing rules are automatic exceptions to organization-wide defaults for particular groups of
users, so they can get to records they don’t own or can’t normally see. Sharing rules, like
role hierarchies, are only used to give additional users access to records. They can’t be
stricter than your organization-wide default settings.
Manual sharing allows owners of particular records to share them with other users.
Although manual sharing isn’t automated like org-wide sharing settings, role hierarchies, or
sharing rules, it can be useful in some situations, such as
o when a recruiter going on vacation needs to temporarily assign ownership of a job
application to someone else.
Record Modification Fields: All objects include fields to store the name of the user who created
the record and who last modified the record. This provides some basic auditing information.
Login History: You can review a list of successful and failed login attempts for the past six
months. For more information, see Monitor Login History.
Field History Tracking: You can turn on auditing to automatically track changes in the values of
individual fields. Although field-level auditing is available for all custom objects, only some
standard objects allow it. For more information, see Field History Tracking.
18
Setup Audit Trail: The Setup Audit Trail logs when modifications are made to your organization’s
configuration.[7]
Figure 4.1 shows about Controlling Data Access with Salesforce Platform
19
Chapter 5
Apex & Testing, Debugging
5.1 Apex Triggers
Apex triggers enable you to perform custom actions before or after events to records in
Salesforce, such as insertions, updates, or deletions. Just like database systems support triggers,
Apex provides trigger support for managing records. Typically, you use triggers to perform
operations based on specific conditions, to modify related records or restrict certain operations from
happening. We can use triggers to do anything you can do in Apex, including executing SOQL and
DML or calling custom Apex methods.
Use triggers to perform tasks that can’t be done by using the point-and-click tools in the
Salesforce user interface. For example, if validating a field value or updating a field on a record, use
validation rules and flows instead. Triggers can be defined for top-level standard objects, such as
Account or Contact, custom objects, and some standard child objects. Triggers are active by default
when created. Salesforce automatically fires active triggers when the specified database events
occur.
5.1.1 Trigger Syntax
The syntax of a trigger definition is different from a class definition’s syntax. A trigger
definition starts with the trigger keyword. It is then followed by the name of the trigger, the
Salesforce object that the trigger is associated with, and the conditions under which it fires. A
trigger has the following syntax:
trigger TriggerName on ObjectName (trigger_events) {
code_block
}
5.1.2 Types of Triggers
There are two types of triggers.
Before triggers are used to update or validate record values before they’re saved to the database.
After triggers are used to access field values that are set by the system.
5.1.3 Using Trigger Exceptions
You sometimes need to add restrictions on certain database operations, such as preventing
records from being saved when certain conditions are met. To prevent saving records in a trigger,
call the addError() method on the Object in question. The addError() method throws a fatal error
inside a trigger. The error message is displayed in the user interface and is logged. The following
trigger prevents the deletion of an account if it has related opportunities. By default, deleting an
20
account causes a cascade delete of all its related records. This trigger prevents the cascade delete of
opportunities. Try this trigger for yourself! If you’ve executed the previous example, your org has
an account called Apples & Oranges with a related opportunity. This example uses that sample
account.
5.1.4 Triggers and Callouts
Apex allows you to make calls to and integrate your Apex code with external Web services.
Apex calls to external Web services are referred to as callouts. For example, you can make a callout
to a stock quote service to get the latest quotes. When making a callout from a trigger, the callout
must be done asynchronously so that the trigger process doesn’t block you from working while
waiting for the external service's response.
The asynchronous callout is made in a background process, and the response is received
when the external service returns it. To make a callout from a trigger, call a class method that
executes asynchronously. Such a method is called a future method and is annotated with
@future(callout=true). This example class contains the future method that makes the callout.[8]
5.2 Apex Testing
The Apex testing framework enables you to write and execute tests for your Apex classes
and triggers on the Lightning Platform. Apex unit tests ensure high quality for your Apex code and
let you meet requirements for deploying Apex.
Testing is the key to successful long-term development and is a critical component of the
development process. The Apex testing framework makes it easy to test your Apex code. Apex
code can only be written in a sandbox environment or a developer org, not in production. Apex
code can be deployed to a production org from a sandbox. Also, app developers can distribute Apex
code to customers from their developer orgs by uploading packages to the Lightning Platform
AppExchange. In addition to being critical for quality assurance, Apex unit tests are also
requirements for deploying and distributing Apex.
These are the benefits of Apex unit tests.
Ensuring that your Apex classes and triggers work as expected
Having a suite of regression tests that can be rerun every time classes and triggers are updated
to ensure that future updates you make to your app don’t break existing functionality
Meeting the code coverage requirements for deploying Apex to production or distributing
Apex to customers via packages
High-quality apps delivered to the production org, which makes production users more
productive
21
High-quality apps delivered to package subscribers, which increase your customers trust
5.2.1 Test Method Syntax
Test methods are defined using the @isTest annotation and have the following syntax: @isTest
static void testName() {
// code block
}
The @isTest annotation takes multiple modifiers within parentheses and separated by blanks.
We’ll cover one such parameter later. The visibility of a test method doesn’t matter, so declaring a
test method as public or private doesn’t make a difference as the testing framework is always able
to access test methods. For this reason, the access modifiers are omitted in the syntax
5.2.3 Create and Execute a Test Suite
A test suite is a collection of Apex test classes that you run together. For example, create a
suite of tests that you run every time you prepare for a deployment or Salesforce releases a new
version. Set up a test suite in the Developer Console to define a set of test classes that you execute
together regularly.
You now have two test classes in your org. These two classes aren’t related, but let’s
pretend for the moment that they are. Assume that there are situations when you want to run these
two test classes but don’t want to run all the tests in your org. Create a test suite that contains both
classes, and then execute the tests in the suite.[9]
22
Apex for callouts to external systems, operations that require higher limits, and code that needs to
run at a certain time. The key benefits of asynchronous processing include:
User efficiency
Let's say you have a process that makes many calculations on a custom object whenever an
Opportunity is created. The time needed to execute these calculations could range from a minor
annoyance to a productivity blocker for the user. Since these calculations don't affect what the user
is currently doing, making them wait for a long running process is not an efficient use of their time.
With asynchronous processing the user can get on with their work, the processing can be done in
the background and the user can see the results at their convenience.
Scalability
By allowing some features of the platform to execute when resources become available at
some point in the future, resources can be managed and scaled quickly. This allows the platform to
handle more jobs using parallel processing.
Higher Limits
Asynchronous processes are started in a new thread, with higher governor and execution
limits. And to be honest, doesn’t everyone want higher governor and execution limits?
23
The enqueued request is removed from the queue and processed. If the processing fails,
transaction control ensures that requests are not lost.
5.3.2 Resource Conservation
Asynchronous processing has lower priority than real-time interaction via the browser and
API. To ensure there are sufficient resources to handle an increase in computing resources, the
queuing framework monitors system resources such as server memory and CPU usage and reduce
asynchronous processing when thresholds are exceeded. This is a fancy way of saying that the
multitenant system protects itself. If an org tries to “gobble up” more than its share of resources,
asynchronous processing is suspended until a normal threshold is reached. The long and short of it
is that there’s no guarantee on processing time, but it’ll all work out in the end.[10]
24
Chapter 6
Case Study
6.1 Apex specialist
Use Case
There are two kinds of people in this world: those who would travel in a recreational vehicle
(RV) and those who wouldn’t. The RV community is increasing exponentially across the globe.
Over the past few years, HowWeRoll Rentals, the world’s largest RV rental company, has increased
its global footprint and camper fleet tenfold. HowWeRoll offers travellers superior RV rental and
roadside assistance services. Their tagline is, “We have great service, because that’s How We
Roll!” Their rental fleet includes every style of camper vehicle, from extra large, luxurious homes
on wheels to bare bones, retro Winnebagos.
You have been hired as the lead Salesforce developer to automate and scale HowWeRoll’s
reach. For travellers, not every journey goes according to plan. Unfortunately, there’s bound to be a
bump in the road at some point along the way. Thankfully, HowWeRoll has an amazing RV repair
squad who can attend to any maintenance request, no matter where you are. These repairs address a
variety of technical difficulties, from a broken axle to a clogged septic tank.As the company grows,
so does HowWeRoll’s rental fleet.
While it’s great for business, the current service and maintenance process is challenging to
scale. In addition to service requests for broken or malfunctioning equipment, routine maintenance
requests for vehicles have grown exponentially. Without routine maintenance checks, the rental
fleet is susceptible to avoidable breakdowns.That’s where you come in! HowWeRoll needs you to
automate their Salesforce-based routine maintenance system.
You’ll ensure that anything that might cause unnecessary damage to the vehicle, or worse,
endanger the customer is flagged. You’ll also integrate Salesforce with HowWeRoll’s back-office
system that keeps track of warehouse inventory. This completely separate system needs to sync on a
regular basis with Salesforce. Synchronization ensures that HowWeRoll’s headquarters (HQ)
knows exactly how much equipment is available when making a maintenance request, and alerts
them when they need to order more equipment.
25
You’ll be working with the following standard objects:
Maintenance Request (renamed Case) — Service requests for broken vehicles, malfunctions, and
routine maintenance.
Equipment (renamed Product) — Parts and items in the warehouse used to fix or maintain RVs.
Custom Objects
Vehicle — Vehicles in HowWeRoll’s rental fleet.
Equipment Maintenance Item — Joins an Equipment record with a Maintenance Request record,
indicating the equipment needed for the maintenance request.
Automate Maintenance Requests
With the exponential increase in RV popularity worldwide, HowWeRoll is supplying
hundreds more luxury and economy vehicles around the globe. Along with this increase in their
rental stock comes an inevitable increase in equipment failure. HowWeRoll has an existing process
to handle these failures, but they want you to build an automation for their routine maintenance.
You’ll build a programmatic process that automatically schedules regular check-ups on the
equipment based on the date that the equipment was installed.
When an existing maintenance request of type Repair or Routine Maintenance is closed,
create a new maintenance request for a future routine check-up. This new maintenance request is
tied to the same Vehicle and Equipment Records as the original closed request. This new request's
Type should be set as Routine Maintenance. The Subject should not be null and the Report Date
field reflects the day the request was created. Remember, all equipment has maintenance cycles.
Calculate the maintenance request due dates by using the maintenance cycle defined on the
related equipment records. If multiple pieces of equipment are used in the maintenance request,
define the due date by applying the shortest maintenance cycle to today’s date. Design the code to
work for both single and bulk maintenance requests.
For now, don’t worry about changes that occur on the equipment record itself. Also expose
the logic for other uses in the org. Separate the trigger (named MaintenanceRequest) from the
application logic in the handler (named MaintenanceRequestHelper). This setup makes it simpler to
delegate actions and extend the app in the future.
26
Write a class that makes a REST callout to an external warehouse system to get a list of
equipment that needs to be updated. The callout’s JSON response returns the equipment records that
you upsert in Salesforce. Beyond inventory, ensure that other potential warehouse changes carry
over to Salesforce. Your class maps the following fields:
Use the warehouse SKU as the external ID to identify which equipment records to update
within Salesforce. Although HowWeRoll is an international company, the remote offices follow the
lead of the HQ’s work schedule. Therefore, all maintenance requests are processed during HQ’s
normal business hours. You need to update Salesforce data during off hours (at 1:00 AM). This
logic runs daily so that the inventory is up to date every morning at HQ.
Unit Tests
First, test the trigger to ensure that it works as expected. Follow best practices by testing for
both positive use cases (when the trigger needs to fire) and negative use cases (when the trigger
must not fire). Of course, passing a test doesn’t necessarily mean you got everything correct. So add
assertions into your code to ensure you don’t get false positives. For your positive test, assert that
everything was created correctly, including the relationships to the vehicle and equipment, as well
as the due date. For your negative test, assert that no work orders were created.
As mentioned previously, the huge wave of maintenance requests could potentially be loaded at
once. The number will probably be around 200, but to account for potential spikes, pad your class
to successfully handle at least 300 records. To test this, include a positive use case for 300
maintenance requests and assert that your test ran as expected.
When you have 100% code coverage on your trigger and handler, write test cases for your
callout and scheduled Apex classes. You need to have 100% code coverage for all Apex in your
org.
Ensure that your code operates as expected in the scheduled context by validating that it
executes after Test.stopTest() without exception. Also assert that a scheduled asynchronous job is
27
in the queue. The test classes for the callout service and scheduled test must also have 100% test
coverage.[11]
28
you’re super excited, and you can’t wait to tell everyone all about it.Until you report to work on
Day 1. Then you learn that the company hasn’t yet automated their processes in Salesforce.
A robotics company that does everything by hand? Oh, the irony. Reps request deal
approvals by emailing a manager. Managers evaluate leads one by one before assigning them to the
right team. The list of inefficient, error-prone business processes goes on and on. Meanwhile, the
company is missing out on opportunities because the sales team spends too much time keeping
records and not enough time closing deals. If RB Robotics is going to capitalize on its RainbowBot
moment, the company needs to get automated, fast. Fortunately, you know just the Salesforce tools
to handle the job.
Standard Objects
RB Robotics uses the following standard objects to store all deal-related data.
1. Account - Businesses that purchase from RB Robotics (Customer - Direct and Customer -
Channel) and businesses that might purchase in the future (Prospect)
2. Contact - Prospective and existing customers of RB Robotics
3. Opportunity - Potential sale of Rainbowbots or RB Robotics assembly systems
Custom Objects
For the purposes of this Super badge, RB Robotics uses one custom object.
Robot Setup—Information about RB Robotics robot setup. Each robot setup record has a Master-
Detail relationship to an opportunity.[12]
Fields
Name
Date
Notes
Day of the Week
29
Figure 6.2 Completion of Process automation super badge
30
Conclusion
In every software development, testing plays a crucial role to make it successful. In Apex
also, testing is necessary to test the functionality of the product. In Apex we will check the
behaviour and actions of the product. We will have specific methods and classes to implement unit
tests. Unit tests make the code error-free. In this way, we will test the apex code to develop a
successful software product. In Lighting Platform Customized page layouts and enabled feed
tracking on Chatter. With all this hard work, we have made a recruiting team.
We’ve also made Recruiting apps much more efficient. Now we have a more user-friendly
app and much easier access to the information we need to do this job well. Approval process
automates help the users view open approval requests by adding the Items to Approve component to
their Home page. Also made users respond to approval requests directly from email or Chatter.
31
REFERENCES
https://www.forcetalks.com/blog/sales-cloud-in-salesforce-all-about-it/
https://www.forcetalks.com/blog/oauth-2-0-client-credentials-flow-salesforce-
developer-guide/
https://www.forcetalks.com/blog/salesforce-crm-implementation-challenges-and-
solutions/
https://www.forcetalks.com/blog/managed-services-the-go-to-model-for-salesforce-
users/
https://www.forcetalks.com/videos/data-migration-salesforce-admin-tutorial/
https://www.forcetalks.com/videos/salesforce-salaries-in-current-market/
https://www.forcetalks.com/videos/is-salesforce-career-recession-proof/
https://www.forcetalks.com/videos/validation-rules-in-salesforce-video-tutorial-
guide/
https://www.forcetalks.com/blog/user-agent-flow-in-salesforce-the-developer-guide/
https://www.forcetalks.com/blog/top-5-ways-salesforce-cdp-solves-customer-data-
challenges-and-benefits-business-growth/
https://www.forcetalks.com/blog/crm-and-rule-based-sitecore-personalization-improves-
conversion-rates-salesforce-case-study/
https://www.forcetalks.com/blog/how-salesforce-mobile-app-can-help-your-business/
https://www.forcetalks.com/blog/learn-all-about-the-lightning-web-components-
in-salesforce/
https://www.forcetalks.com/blog/all-about-data-modelling-in-salesforce/
https://www.forcetalks.com/blog/understanding-web-server-authentication-
flow-web-app-integration/
https://www.forcetalks.com/videos/how-to-logging-automated-emails-on-related-
records/
https://www.forcetalks.com/blog/salesforce-consulting-services-the-missing-piece-in-
puzzle-for-users-and-partners/
https://www.forcetalks.com/blog/salesforce-commerce-cloud-explained-pricing-hosting-
performance-scalability
32