SPD Unit-1
SPD Unit-1
SPD Unit-1
R-22
MR22-1CS0155
• Salesforce is known for its flexibility, scalability, and ability to customize to meet the
specific needs of different industries and businesses.
Understand the Salesforce Architecture
The Salesforce architecture is composed of numerous layers that are stacked on top of one
another. The diagram below illustrates these layers.
Multi-tenant
Multi-tenant architectures, in which multiple tenants use the same application, are popular. In this scenario, the
developer may create a Salesforce Application and upload it to the cloud, and then share it with multiple clients. The
application may be cost-effective because it is distributed among multiple clients. The development and maintenance
costs of an application can be shared at once, making it very economical per client.
Salesforce data is placed in a single database schema for all its customers.
Resources and maintenance are shared in the instance of low economic activity.
A single software server can host multiple tenants, but multiple instances of the same server are not allowed.
The provider must make one change to all of his clients‟ applications and those changes will be applied to all
of his clients.
Metadata API Services
The Salesforce platform follows the meta-data The Salesforce metadata-driven model allows the
development model. The metadata means data about developers to create their applications easily with the help of
the data. various tools.
Salesforce stores the metadata in the shared But sometimes developers need some more
database along with the data. It means it stores the functionalities for their apps to make some modifications. To
data as well as what data does. make such modifications, Salesforce provides a powerful APIs.
The tenant-specific data ensures that the These APIs helps the developers to customize the Salesforce
common data is only shared with one tenant, not with application. These APIs allows the various bits of
another tenant or group. This ensures the security of the programming to interface with each other and trade data.
data even in the shared database. Without knowing many details, we can connect our apps with
other apps.
The API provides a simple but powerful, and open way to
programmatically access the data and any app running on the
Salesforce platform.
These APIs helps the developers to access apps from
any location, using any programming language that supports
Web services, like Java, PHP, C#, or .NET.
Some important points to get introduced to Salesforce
1. Salesforce is a multi-tenant cloud company that is protected by a trusted and multi-cloud ecosystem.
2. All of Salesforce‟s services are supported by the Salesforce platform, which is composed of numerous metadata parts,
including data services, artificial intelligence, and robust APIs for development.
3. Salesforce Marketing Cloud and Sales Cloud are pre-built offerings within Salesforce that all apps rely on for their
functionality. All apps sit atop the Salesforce platform, so you can create your apps using the platform or use Salesforce‟s
pre-built offerings.
4. Salesforce Einstein‟s predictive intelligence and the lightning framework are designed to meet the needs of customers.
Everything is integrated with Salesforce. Platform technologies, such as Salesforce Einstein, are built to meet the customer‟s
convenience.
Understand the Salesforce Architecture
Understand the Salesforce Architecture - Terminologies in Salesforce
Org in Salesforce:
- Org is an abbreviation for organization.
- A salesforce org is a unique version of Salesforce for a specific tenant, containing their data
and configuration.
- Every org will have a unique ID
- We can find your own org id in the Company Information page within Salesforce.
POD in Salesforce:
- A Point of Deployment is also known as an Instance.
- A cluster of infrastructure (servers, software, networking equipment, etc.) that hosts many orgs.
- It is a self contained unit containing all that is required to run Salesforce.
- Each customer is allocated to one and only POD and that is where their data resides.
Create free Developer Account in Salesforce
1.Go to http://developer.salesforce.com/signup
2. Fill all details with valid Email Address.
3.An Email will be sent to your Email Address.
4. Now click the link provided in Email.
5. Set your password to your account.
6. Now you are able to login with salesforce
developer account.
7. Go to https://login.salesforce.com.
8. Enter your Username and Password click on LogIn.
Data Modeling
Object:
Tab:
• used to expose an object and its data to the end user through the web interface.
Type of Tab
Action
Visibility
If you select this type of visibility, then the bar at the top displays the
Default On
particular tab, along with the other tabs.
If you select this type of visibility, then the user will have to click the „+‟
Default Off
icon on the bar at the top, next to all the other tabs that are visible.
If you select this visibility option, then it will hide the tab from the bar at the
Tab Hidden
top, and the user won‟t be able to access it even with the „+‟ icon.
Data Modeling - Object &Tab, Fields, Records in Salesforce
Field:
Record:
Users cannot delete standard objects instead, salesforce allows users to create
custom fields on standard objects.
List of Standard Objects
1.Account: Refers to a business or organization that you have a business relationship with, such as a
customer or partner.
2.Contact: This object represents an individual who is associated with an account, like a customer, partner,
or vendor contact.
3.Lead: Refers to a possible sales opportunity. If a lead is deemed qualified, it can be converted into an
account, a contact, or an opportunity.
4.Opportunity: Refers to a possible sale that is linked to a particular account. It contains details such as the
stage of the sales process, the likelihood of it actually happening, the amount of the sale, and when it is
expected to be completed.
5.Case: This object indicates that there is an issue or inquiry from a customer that needs to be resolved.
6.Task: This object describes an item that can be assigned to a user for action, such as a call, email, or
meeting.
7. Event: Refers to a type of entry in a calendar, such as a meeting or appointment, which can be
linked to other Salesforce items like accounts, contacts, and opportunities.
8. Campaign: Represents a marketing initiative such as an email campaign, trade show, or webinar. It
is used to generate leads and drive sales.
9. Quote: Describes a sales proposal that is closely linked to an opportunity. It contains information
about the products being sold, their prices, and the terms of the sale.
10. Product: This refers to a product or service that is available for sale to customers and can be linked
to opportunities, quotes, and orders.
11. Pricebook: A collection of products and prices for those products. They can be used to manage
pricing for different customers or sales channels.
12. Contract: A binding agreement between your organization, a customer, or a partner. It can be
associated with accounts and opportunities.
Data Modeling - Custom Object
• customized object created to store information specific to your organization‟s
requirements and processes.
• It is developed to capture unique data and precise data for your business.
• Contradictory to standard objects, it is manually created by the user and adds data per
the requirement.
• For example, a courier company can create a custom object to store the schedule and
dispatch details for every week.
5. For Plural Label, enter the plural form of your custom object name.
Steps to Create a custom object in Salesforce
6. Scroll to the bottom of the page, and select the checkbox Launch New Custom Tab
Wizard after saving this custom object. Selecting this box will add your custom object
as a tab in Salesforce.
7. Click Save.
8. On the New Custom Object Tab page, click the Tab Style field, and choose a style.
The style sets the icon to display in the UI for the object.
9. Click Next, Next, and Save.
Data Modeling - Standard Fields
• Fields that are already present in Salesforce for standard and custom objects by
default and cannot be deleted or edited.
• Salesforce provides four standard fields in every custom object by default that are:
• Created By
• Last Modified By
• Owner and
• Users can add different kinds of data depending on the requirements with help of
fields data type which is available on field creation.
Data Modeling - Field Types in Salesforce
• Every standard and custom object has fields attached to it.
• When these fields are created in Salesforce, the User has to choose their data
type such as Text, Text Area, Number, PickList, etc.
• In the following table, we categorized some of the fields' data type and their
properties.
Data Modeling - Field Types in Salesforce
Data Modeling - Field Types in Salesforce
Data Modeling - Field Types in Salesforce
How To Create Custom Fields In Salesforce
• From Setup, go to Object Manager.
• Select the Object on which you wanted to create a field.
• In the sidebar, click Fields & Relationships. Notice that there are already some fields there. There‟s a
name field and some of the system fields you learned about earlier.
• Click New in the top right.
• For data type, select any data type based on the requirement.
• Click Next.
• Fill out the following:
• Field Label:
• Description:
• Check the Required box.
• Click Next, Next again, and then Save.
How To Create Custom Fields In Salesforce
Data Modeling - Work with Schema Builder
• Schema Builder is a tool that lets you visualize and edit your data model.
1. From Setup, search for and click Schema Builder in the Quick Find box.
Data Modeling - Work with Schema Builder
• In the left panel, click Clear All.
• From the Objects Palette select the Objects. For example here we are
taking Account, Contact and Opportunity.
• Click Auto-Layout.
• Blue connections are lookup relationship and red connections are master detail relationship.
Data Modeling - Work with Schema Builder
• You can drag these objects around the canvas.
• But it can help you visualize your data model in a useful way.
• Schema Builder is a handy tool for introducing your Salesforce customizations to a co-
worker or explaining the way data flows throughout your system.
Data Modeling - Work with Schema Builder
Create an Object with Schema Builder:
• In the left sidebar, click the Elements tab.
• Enter information about your object. You can make it whatever you want.
• Click Save.
Data Modeling - Work with Schema Builder
Create Fields with Schema Builder:
Creating fields with Schema Builder is just like creating objects.
• From the Elements tab, choose a field type and drag it onto the object you just created.
Notice that you can create relationship fields, formula fields, and normal fields in
Schema Builder.
• Click Save.
Data Modeling - Object Relationships in Salesforce
• Object relationships are a special field type that connects two or more objects together.
• It defines how records in one object are associated with records in another object.
• The field is created on the many side object (child) and it is related to the one side object(Parent).
Example:
• If a sales rep opens an account, they‟ve probably been talking to a few people at that account‟s
company.
• They‟ve probably made contacts like executives or IT managers and stored those contacts‟
information in Salesforce.
Data Modeling - Object Relationships in Salesforce
• Lookup, and
• Master-Detail
Data Modeling - Master-Detail Relationship
• A tightly coupled relationship where one object (detail) is considered subordinate to another object (master).
• When a parent record is deleted, all of its child records are also deleted.
• It is used when we want to control the display of detail records based on the value in the master record.
• The detail record inherits the permission and the sharing rule from master records.
• It links one master (parent) record to one or more detail (child) records.
• Make sure that no records should be created on detail(Child) object.
• It enables one object (child) to link to another object (parent) without requiring the parent record to be
present.
• A single-parent record can have multiple child records linked to it, and the child record can exist
independently of the parent record.
• Child records in a lookup relationship are not owned by the parent record.
• When a parent record is deleted, the child record is not affected, and the lookup field on the child
record is left empty.
• Lookup relationships do not automatically inherit the parent record‟s sharing and security settings.
Access to the parent record does not allow access to the child records that are related to it.
Lookup Relationship Field created in Many Object
Lookup Relationship
Student ( Many)
Teacher (One)
S. Id S.Name FEE Year
T. Id TName Experience
S-01 Student1 45000 III
T-001 Ravi 10
S-02 Student2 45000 III
T-002 Ashok 12
S-03 Student3 50000 II
BOOK
Student
B.No. BName Price Rel Std.No
Std.No SName Taken Book
B1 C++ 1200 S-002
S-001 Ravi B2
B2 Python 1700 S-001 S-002 Ashok B1
Steps to create Lookup Relationship field
2. Choose the Child Object that will be part of the Lookup Relationship.
3. Click on Custom Fields and Relationship, then click the New button.
Steps to create Lookup Relationship field
4. Select the Lookup Relationship option and click on Next.
5. Choose the Related to Object label, and then select the Child Object. Provide the Field
Label, Field Name, and click “Next.”
Steps to create Lookup Relationship field
6. Configure the field-level security for the reference field. Ensure all profiles have access
to the field-level security, then click “Save.”
7. Select the page layout for the child object field and select “Next.”
8. Click “Add Custom Related List” in the new window and click “Save.”
Data Management
• Data Managements means import/export of data (or data sets) from/to the external system
using out of the box or third-party tools.
1. Data Import- Importing means uploading and syncing datasets from various
databases or cloud repositories into your Salesforce account.
• Update – Modifies existing records in Salesforce with the help of a record id or external
id.
• Upsert – Combination of insert and update. It modifies the existing records and creates a
new one if the record is unavailable in the organization.
Data Management
Steps to Use the Data Import Wizard:
Step 1: Prepare your file for import After preparing your import data, save it as a CSV file.
ii. Review the information provided on the welcome page, then click Launch Wizard!
Data Management
Step 3: Choose the data that you want to import.
i. To import accounts, contacts, leads, solutions, person accounts, or campaign members, click Standard Objects.
ii. To import custom objects, click Custom Objects.
iii. Specify whether you want to add new records to Salesforce, update existing records, or add and update records
simultaneously.
iv. Specify matching and other criteria as necessary. Hover over the question marks for more information about each option.
v. Specify the file that contains your data. You can specify your data file by dragging the CSV to the upload area of the
page or by clicking the CSV category you‟re using and then navigating to and selecting the file.
vi. Choose a character encoding method for your file. Most users can accept the default character encoding.
vii. Click Next.
Data Management
Step 4. Map your data fields to Salesforce data fields. Salesforce will mark your unmapped fields. Click Map under
the Edit column to change and map the fields to an existing Salesforce field.
importing and exporting data but also does updating and deleting data.
• The Data Loader is a complex tool that supports all standard objects and custom objects.
• a client application that can import up to 150 million records at a time, of any data type, either from files or a database
connection the ability to handle large volumes of data, the Data Loader is ideal for complex data migration tasks.
• It can be operated either through the user interface or the command line.
• You need to specify data sources, field mappings, and other parameters via configuration files.
• This makes it possible to automate the import process, using API calls.
Use Data Loader When:
You need to load 50,000 to 150 million records.
You need to load into an object that is not supported by the Data Import Wizard.
You want to schedule regular data loads, such as nightly imports.
Data Management
Export Data:
• Data export tools provide a convenient way to obtain a copy of your Salesforce data, either
for backup or for importing into a different system.
• Data Loader
Data Management
Data Export Service:
• It allows you to export data manually once every 7 days (for weekly export) or 29 days (for
monthly export).
• In Professional Edition and Developer Edition, you can generate backup files only every
29 days, or automatically at monthly intervals only.
Data Management
Steps to Use the Data Export Service:
Step 1: Navigate to the Data Export option on Salesforce
On the Salesforce interface, navigate to Setup and enter Data Export in the search box.
files. This is useful if you plan to use your export files for importing or other integrations.
Data Management
Select the types of info you want to include in your export. If you‟re not familiar with Apex API names, choose Include all
data and click Start Export.
Salesforce creates a zip archive of CSV files and emails you when it's ready.
However, we can't guarantee the date and time the export will complete. Large exports are broken up
into multiple files.
Follow the link in the email or click Data Export to download the zip file.
Data Loader:
• It can be operated either through the user interface or the command line.
• The latter option is useful if you want to automate the export process, or use APIs to
integrate with another system.
Picklist Administration
Salesforce Picklist Fields
• A picklist is a list box of pre-defined values. The user can only select one of the pre-defined values.
• Only the Administrator has the ability to add or delete picklist values. It is a simple dropdown menu of
options.
• When we create a picklist we need to set individual values (specific to a single picklist field).
• Create a global value set. When we need to share with more than one picklist field, we can set
a global value set.
There are three different types of picklists available in Salesforce:
1. Standard
2. Custom
3. Custom Multi-Select
1. Standard Picklists:
⮚ These picklists are the default options provided within your Salesforce org, requiring no
customization.
⮚ They typically consist of common fields essential for standard objects within your organization.
⮚ For example,
In a Lead object, there is a picklist field named LeadSource which is a standard
picklist. It has some standard value sets.
It also utilized for the Account Source picklist field on the Account object.
Changes made to these standard picklist values are reflected across related fields.
Standard Picklists
2. Custom Picklists: (Global value set)
As their name suggests, these picklists are user-created according to specific requirements.
Users can add their own values and configure custom picklists‟ behavior to align with their needs.
A Global Picklist Value Set in Salesforce means a picklist which you can access for all
salesforce objects.
Step 3: Enter a label, name, and description. Then put all the Picklist values in the provided Text
area as one value per line.
Step 4: Optionally choose to sort the values or to use the first value in the list as the default value,
or both. You can‟t change these settings later.
Note:
&& Logical AND • && has precedence over ||
• This operator exhibits short-circuiting behavior, which means y
is evaluated only if x is true.
• x and y can‟t be null.
If x, a Boolean, and y, a Boolean, are both false, then the
expression evaluates to false. Otherwise the expression evaluates to
true.
Note:
|| Logical OR
• && has precedence over ||
• This operator exhibits short-circuiting behavior, which means y
is evaluated only if x is false.
• x and y can‟t be null.
Formulas and Validations - Logical Operator
Example:
Logical AND:
a = 10, b = 20, c = 20
condition1: a < b
condition2: b == c
if(condition1 && condition2)
d=a+b+c
Logical OR:
a = 10, b = 20, c = 20
condition1: a < b
condition2: b > c
if(condition1 || condition2)
d=a+b+c
For example, we could use a roll-up summary field to display the total value (amount) from
opportunities on a related account.
BOOK
B.No. BName Price Rel- Book
BH.No Count
B1 C++ 1200 H-02 1
B2 Python 1700 H-01 2
Formulas and Validations - Validation Rules
• Validation rules verify that the data a user enters in a record meets the standards you
specify before the user can save the record.
• 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”.
• Validation rules also include an error message to display to the user when the rule returns
a value of “True” due to an invalid value.
Formulas and Validations - Validation Rules
2. toLowerCase()
• The „toLowerCase()‟ method performs the reverse of toUpperCase(). It converts each character within a
string to its respective lowercase counterpart.
EXAMPLE: If you have a string “SALESFORCE”, employing the „toLowerCase()‟ method will
yield “salesforce”.
Salesforce String functions
3. contains()
• The „contains()‟ method verifies if a string includes a specific substring.
• The method provides a boolean value: true when the substring exists, and false when it does
not. This function is beneficial for locating particular text within a more extensive string.
• You can create search functionality within your Salesforce applications.
• Check for the “@” symbol in Email Validation.
EXAMPLE:
String myProductName1 = 'HCL‟;
String myProductName2 = 'NAHCL‟;
Boolean result = myProductName2.contains(myProductName1);
System.debug('O/p will be true as it contains the String and Output is:'+result);
Salesforce String functions
4. trim()
• The „trim()‟ method erases whitespace at both the starting and ending points of a text string.
• This function is especially valuable for cleaning up user input, such as eradicating extra spaces
before storing data in Salesforce. It cleans up data before saving it to Salesforce.
5. substring()
• The „substring()‟ method retrieves a segment of a string based on the provided start and
end index values.
• This function is handy for decomposing strings into smaller parts or extracting specific
information from a larger text.
EXAMPLE: Verify the domain extension in Email validation.
Salesforce String functions
6. replace()
• The „replace()‟ method replaces a specific substring with another substring within the original
string.
• This method is useful for correcting misspellings or updating specific text within a string.
EXAMPLE: You can update a query with new criteria or filters based on user input.
7. replaceAll()
• The „replaceAll()‟ method is similar to „replace()‟, but it replaces all occurrences of the specified
substring with another substring.
Salesforce String functions
8. equals()
• This method will return true if the given string and the string passed in the method have the same
binary sequence of characters and they are not null.
• This method is case-sensitive.
• You can compare the SFDC record id as well using this method.
EXAMPLE:
String myString1 = 'MyString‟;
String myString2 = 'MyString‟;
Boolean result = myString2.equals(myString1);
System.debug('Value of Result will be true as they are same and Result is:'+result);
Salesforce Application
Application, commonly referred to as App, is a particular tool or program used to complete a specific set of
functions.
Used as a container to store all the tabs and objects along with their functionality.
Various tabs form a group that eventually works together and performs multiple responsibilities of the app.
An App simply consists of 3 major components,
1. Logo
2. Name
3. Ordered Set of Tabs
We have two types of apps in Salesforce,
Standard Apps
• Standard apps come with every occurrence of Salesforce as default.
• These apps are already included in the Salesforce instant, and we get default access to them.
• Users have a little bit of control over making necessary changes and get the best output.
• However, some aspects like description, label, and logo are fixed, and we can‟t change them.
Custom Apps
• Custom apps are created according to the needs of a company to fulfill specific demands of a business.
• Custom Apps are user-oriented.
• On top of it, we can combine standard and custom tabs to create a unique app accordingly.
• The best thing is that we can change the logo and other details in the future if necessary.
We can see a list of both standard and custom apps on the platform by clicking on the
“App Launcher” on the Salesforce home page.
Steps to Create a Custom Salesforce app
1. Search for “apps” on the “Quick Find” box and select “App Manager.”
2. It leads you to the Lightning Experience App Manager. Here, you can choose the “New Lightning App”
option to begin the custom app creation.
3. On the window that pops up, enter the app name, developer name, and description. We can also pick a color
theme for the app or upload an image containing the app logo in this step.
4. Then, click the “Next” button to start setting up app options. We can select the preferred navigation style,
supported form factors, setup experience, and app personalization settings. For now, you can go with the default
options provided here in this step.
5. Now, click “Next” to go to the “Utility Items” page. You can keep it as default and move to the next page
by click on to the “Next” button.
6. Here, we have to choose a set of items to include in the app. The left side of the page shows a list of standard
objects Salesforce provides, such as Accounts and Assets. For example, let‟s simply pick the Accounts object to
add to the new app (University Management).
7. Then, go to the next page to select profiles for your app. You can search for the default “System
Administrator” profile and add it to the app
8. Next, save and finish the app creation process. Now we can view this new app (University Management) on
the App Launcher.