Вы находитесь на странице: 1из 1

Reply

SFDC Notes
Salesforce study notes, tips and tricks!

Home Admin Cert Notes  Links Contact About Search

Home » Admin-5-Standard and Custom Objects-18%

Categories Admin-5-Standard and Custom Objects-18%


This chapter’s objectives are:
Analytics (1)
Communities (1) 5.1- Describe the standard object architecture and relationship model
Developer (1) 5.2- Explain how to create, delete, and customize elds, page layouts, and list views for custom and standard
Lead (1) objects
Sales Cloud (1) 5.3- Given a scenario, determine the appropriate elds and page layouts for custom and standard objects
Welcome (1) 5.4- Explain how to create, delete, and customize record types for custom and standard objects

Home 5.1- Describe the standard object architecture and relationship model

Admin Cert Notes All Objects in Salesforce are related, that is, there exist relations between Objects, for example, an Account can
have zero or more opportunities related to it, so the Account Object should be related somehow to the
0-Admin Introduction Opportunity Object .
To visualize the relation between Objects, we use ERD (Entity Relationship Diagram)
1–Organization Setup–1%
You can check all the di erent relations between Salesforce Objects in the Salesforce Data Models
2–User Setup–9% documentation: SF Data Models: https://developer.salesforce.com/docs/atlas.en-
us.api.meta/api/data_model.htm
3–Global User Interface–1% To better understand this concept, check out this excellent Video of ERD Tutorial for Beginners by Gina Baldazzi

4-Security and Access-15% Entity Relationship Diagram (ERD) Training Video


Share
5–Standard and Custom
Objects-18%

6-Sales and Marketing


Applications-9%

7-Service and Support


Applications-6%

8-Activity Management-3%

9-Chatter-1%

10-Data Management-11%
Also, check out this other Salesforce Video: Data Modeling for Non-Developers: An Intro
11-Content and Folder
Management-2% Object Relationship Types in Salesforce:

The relationship between Objects can be of di erent types, one-to-


12-Analytics, Reports and
Dashboards-13% many, many-to-many
One to One:
13-Work ow Automation-7% Husband / Wife
A Wife can have one husband only
14-Desktop and Mobile
A Husband can have one Wife only
Administration-2%
One to Many:
15-AppExchange-2% Team / Player
A Player can have one Team only
A Team can have many Players
Links Many to One:
Player / Team
Contact
A Team can have many Players
A Player can have one Team only
About
Many to Many:
Video / Customer
A Customer can rent many videos
Recent Comments A video can be rented by many customers
This is equivalent to 2x One-to-many relationships:
Priya Deepa on How to enable Video / Rental
Salesforce Multi-currency, and A rental can contain One video
what are its implications? A video can have many rentals
Narayanan on How to enable Customer / Rental
Salesforce Multi-currency, and A rental can be for One customer
what are its implications? A customer can do many rentals.
Shibu Kalidhasan on How to Rental (the child of both parents) is called a Junction Object
enable Salesforce Multi-currency,  
and what are its implications?
CJ on Admin-5-Standard and
Custom Objects-18%
Pola on Admin-9-Chatter-1%         

Meta
ERD: Entity Relationship Diagram:
Log in
What is Data Modeling?
Entries RSS
It is simply organizing your information properly.
Comments RSS
3 commandments of DM:
WordPress.org
Do not duplicate data – don store data in multiple places
You want the simplest structure possible while maintain integrity of info
Fields need to directly describe the objects that they are on: ex, email address in the Contact Object
Terminology:

Excel
Name Name SF Name Description Example

RDBMS Relational Database Manager System – a place to store


date!

Entity Table Object represents a thing you want to track in DB Contact

Attributes Column Field various characteristics of an Entity Email

Entity instance Row Record each occurrence of the entity Walid’s Contact

Primary Key Unique Identi er for a single Record Contact ID

Foreign Key Field on an Object that points to the primary key


another record

One-to-Many One record is related to many records using a direct link, Account / Contact
a foreign key ek

Many-to-Many 2x One-to-Many relationships in reverse via a Junction


Object (see above)

ERD Entity Relationship Graphical representation all your objects how they are
Diagram related

Example:
Your company processes training for its products
Class Registration is tracked via Excel
Training is becoming bigger and more complex
Questions to ask:
What are the primary objects you want to track? Students and Classes
One-to-Many or many-to-many? Many-to-Many between students and
classes
How many objects you need? 3, 1 of the Junction Point
Where do your elds go? Check the Excel and arrange the elds as per
the tables. Status should go in the Junction Object as it describes the
Student / Class status

Lookup vs. Master-Detail:


SF speci c terminology
Independent of one to many, many to many
Lookup:
Value in eld is not required
When parent deleted, children orphaned by left intact
Can be any combination of custom / standard objects
Just a basic link between 2 objects, not enough features
Example: account / contact
Master-Details:
Value required (ex. cannot have registration without a course)
When parent deleted, children deleted (when you delete class,
registration deleted)
Standard Object can only be a parent. Custom can be both
Inherited secutiy” if you can view parent record, you can view
children
Extra: sharing options, UI functionality, reporting capabilities,
data analytics tools for example, you can do Roll-Up Summary on
parent
How to do this scenario?
First create the 3 Object: Build | Create | Objects
Class, Registration and Contact (already created)
For Registration, Unique ID will be a Number (RegCode) – this is the Junction Object
Registration will have 2 Master-Details Relations, one with Class and another with
Contact (we will call this eld “Student”. Registration is the child of both.
These relation will be created from the child object custom elds section
Also add another eld called Status (dropdown) in the Registration Object
Extra stu on the parents::
Roll-Up summary elds (RSF) on the Class Object (one of the parent of the Registration Object
Create new custom eld on Class, eld type: Roll-up summary, call it Number of Registered, choose type to
be sum, choose the lter to be Status Not Equal to Cancel (this way you don’t count the cancelled ones)
Create Formula eld called “Slots Remaining” with
type=number, next page enter the formula among
elds.
Add the Slots remaining to the Search Layout (to
show it when you click on a list view) – Serouj.

5.2- Explain how to create, delete, and customize elds, page layouts, and list views for custom and standard
objects
Object (and Tabs):

Custom Object vs. Standard Objects

Manage Objects:
Create: Capture Info
Edit: change Object characteristics and behaviors
Delete: non-permanent removal of Object
Erase: permanent Removal
Undelete: recover object
Create a custom object.
Go to Build | Create | Objects – New Custom Object / Schema Builder
Give Label, Name and Plural Label, give the record name (name or number)
Deployed vs in development
Check the box launch new custom tab wizard to create a tab, or alternatively, you can
create a tab later on by going to Build | Create | Tabs
Tab exposes the Records within the Object to the users
Once created, you can edit it: change label, add elds, layouts,
You can delete custom Object, very hard to recover unlike eld

di erence between an object and a tab:


An object stores the eld de nitions and records.
An object tab is used to expose an object’s records within the user interface.
Di erence between deleting and erasing a custom object: When deleting a custom object some data loss may
occur even if the object is undeleted later (associated work ow rules are lost, for instance). Otherwise, objects
follow the same rules a elds (deleted objects are permanently erased automatically after 15 days).
properties of an object:
Label & Plural Label: How the object is displayed to the user within the user interface.
Name: How the object is referenced programmatically and via the API.
Record Name Label & Format: How record within the object are named (either text or auto-number). The
name eld is what is displayed when the object is referenced in a lookup or master-detail relationship.
Allow Reports: Allows reporting on the object (enables default report types).
Allow Activities: Allow activities to be associated to records of the object type.
Deployment Status: Either “Deployed” or “In Development”. Objects “In Development” can only be viewed by
users with the “Customize Application” permission.

Field History Tracking:

Field history tracking allows you to capture when the values within speci ed elds change when a record is
edited.
Use eld history tracking to create an audit trail of modi cations to your company’s critical data. This can be
particularly helpful in identifying instances where data was updated incorrectly and by whom.
Enable it:
Standard objects: Select “Set History Tracking” within its eld con guration
Custom Objects: Ensure the object properties have “Track Field History” enabled. Then
click “Set History Tracking” and select elds from the object

Once enabled, track the eld change by adding the eld history related list to the page layout

Note: Field history tracking will only track values for speci ed elds once enabled.  Enabling history tracking or
adding additional elds will not yield any historical data
Fields longer than 255 characters (such as long text, rich text, and multi-select picklist elds) do not track values
when changed (only that a change has occurred).
You can track up to 20 elds per object by default (the limit can be raised by contacting Salesforce support, but
may impact record save time)

Create Relationship between Objects:

One to Many: Go to the child Object, in this case the Object that can have 1 of the
other: Object that has Crow foot attached to it — Classes.
Create a new eld on this Child Object, with type Lookup or Master-Detail to the
Parent Object (that will have the Related List at the bottom)

Select the other object to which this object is related (Teachers)


Enter the label and name for the lookup eld
Select the minimum access level required on the Master record to create, edit, or delete related Detail records
In the case of Many-to-many, it is the same, but you have to create 2
relations as per the photos on the right. In this case, go to Course O ering,
create 2 relations one with Course Object and the other with Classroom
Object.
Course O ering Object can also have elds like start date, end date, current
occupancy. Also classroom can have Max occupancy
In the parent page, you can edit the layout and add more elds on the
Course O ering section at the bottom (Serouj):

In the case of one-to-one:

1. Create a master detail relationship between two Object.


2. On master Object create a rollup summary eld which count the child records
3. Now write trigger on child Object which checks if the rollup summary count on master is equal to one
then throw an error that the master have already one record attached select another.

This way every master Object have one record of the other objec hence one to one relaship is established.
You can follow this link for more detail: http://www.infallibletechie.com/2013/05/how-to-create-one-to-one-
relationship.html

Roll-up summary elds

A roll-up summary eld calculates values from related records, such as those in a related list.
You can create a roll-up summary eld to display a value in a master record based on the values of elds in a
detail record. The detail record must be related to the master through a master-detail relationship. For example,
you want to display the sum of invoice amounts for all related invoice custom object records in an account’s
Invoices related list. You can display this total in a custom account eld called Total Invoice Amount.
Roll-up summary elds can be used within a master-detail relationship to summarize data contained within child
records. A maximum of 25 (10 prior to Winter 16 release) roll-up summary elds per object can be created.
It can also be used in:
Any custom object that is on the master side of a master-detail relationship
Any standard object that is on the master side of a master-detail relationship with a custom object
Opportunities using the values of opportunity products related to the opportunity (MDS)
Accounts using the values of related opportunities (Exercise in Certi edondemand)
Campaigns using campaign member status or the values of campaign member custom elds
The types of elds you can calculate in a roll-up summary eld depend on the type of calculation. For example,
Number, currency, and percent elds are available when you select SUM as the roll-up type.
Number, currency, percent, date, and date/time elds are available when you select MIN or MAX as the roll-
up type.
https://help.salesforce.com/HTViewHelpDoc?id= elds_about_roll_up_summary_ elds.htm&language=en_US

Rename Objects and Tabs

You can rename the Standard Tab and Labels, for example, rename Leads to
Prospects, this way this name will be re ected in the whole system.

Step 2 involves all the elds in the Lead Object, I can rename them 1 by 1

Once renamed, I can see that a tab has been renamed, and by whom. And Lead is now
Prospect

But in the left side setup menu, Lead is still named Lead.

Picklist vs Object.

Here are a few guidelines to help determine whether it is appropriate to use a picklist or custom object to capture
data:

Picklist Custom Object

Values are static or nearly static and they can be maintained by an Values change frequently
administrator Values can be added/changed by users
All selectable values are displayed at once (drop down menu) Selectable values can be searched for by users (lookup
Total number of values is relatively low (I’d suggest a maximum of 100, but dialog box)
the actual limits are much higher) The total number of values is high
You can to use controlling and dependent picklists (more details in the eld The value has associated data (e.g. the lead’s favorite
chapter) — this can be done to some extent with lookup lters (see Lookup brand is Dell; Dell’s address is X)
Filters) and a little bit of creativity, but the net result isn’t quite the same Values in this list are used in multiple references (e.g. the
The picklist value does not have any other associated data (e.g. the lead’s lead’s favorite brand is Dell; a marketing campaign is
favorite brand is Dell; no other information about Dell is needed) sponsored by Dell as well)
Values do not need to be validated via the API Values need to be validated via the API (useful for
Values are captured in web-to-lead submissions (web-to-lead does not support integrations)
custom relationship elds). You want to use delegated administration (see Delegated
You want to capture multiple values without creating multiple records (e.g. the Administration) on your custom object
lead’s favorite brands are X, Y,Z; use a multi-select picklist instead of a many to
many relationship)

Lookup Filters

A lookup lter limits which records can be associated


within an object relationship.
For example, when selecting a venue (parent) for a
campaign (child), users should only be able to select
approved venues. You con gure the lookup lter on
the “venue” lookup relationship eld in the “campaign”
Object.
Go to the led in question, go to “Lookup Filter” and ll
it accordingly
Now when users try to choose a value that is not
approved, they get error message.

Fields:

Create new eld to capture information


Can later edit the eld, delete, undelete, erase (after 15 days delete)
Standard vs. Custom elds:

Create custom elds: Same way for both standard and custom Objects. What di ers is where to click for each.
For standard, go to: Build | Customize | Object Name | Fields
For Custom: Build | Create | Object – choose the Object name
Go to the Custom Fields &Relationship, click on New

Field Attributes:
Label: How the eld appears to users.
Name: How the eld is referenced programmatically and via the API.
Unique: Indicates that only one record within the object can have the speci ed value.
External ID: Used for data operations (upsert) referencing the primary key of an external system.
Default Value: Sets the default value for records created.
Required: Ensures the eld must have a value in order for a record to be saved.
By default, each object can have up to 7 (3 prior to Summer 14 Release) unique or external ID elds.
Field Types:
Auto Number: a unique sequence number generated for
every record. Read Only, The sequence can be controlled by
adding date elements and leading 0s.
Checkbox: True/1 for checked False/0 for not
Currency: enter a currency amount
Date: enter a date or pick it from a popup calendar
Date/Time: same, can also add current date/time
Email: validated, can’t be used for mass emailing
External Lookup Relationship: lookup links child to a parent external object from an external datasource.
Formula: automatically calculate values based on other values or elds
Geolocation: specify a location by its latitude and longitude. Counts 3 times against org limits
Hierarchical Relationship: Allows users to use a lookup eld to associate 1 user to another (like manager)
Indirect Lookup Relationship
Lookup Relationship: See above
Master-Detail Relationship: See above
Number: enter a number, any leading zeros are removed
Percent: will convert a number to percentage. 0.10 = 10%.
Phone: enter phone num, with US/Canada format if locale is US/Canada and digits is right. No validated,
Picklist: select a single value from a list that you de ne
Picklist (Multi-select): same as picklist, but multi-value
Roll-Up Summary: see above
Text: any string, You can set a maximum length, up to 255 characters
Text (Encrypted): You can set a maximum length of up to 175 characters. Use ASE 128-bit master keys. To
enable master encryption key management, contact Salesforce
Text Area: up to 255 characters that display on separate lines similar to a Description eld
Text Area (Long): up to 131,072 characters that display on separate lines
Text Area (Rich): With the use of a toolbar, users can format the eld content and add images and links
URL: When users click on the eld, the URL will open in a separate browser window. Can be encrypted.
Changing eld types (e.g. Date/Time to Date) can cause data loss
Most eld types are validated by Salesforce to the corresponding data type (e.g. you cannot enter an invalid email
address into an email eld, period). There are a few exceptions: picklist elds are not validated via the API, and
phone elds are not validated at all.
Some elds are not validated like: phone. User can type anything in this eld. But formatting is only applied when
phone typed through UI, user locale US/Canada, number of digits 10 or 11. If you want to make sure that proper
phones are entered, use Validation Rules.
Partial validation like Picklist and Picklist multi-selection: only validated in the UI (can only enter the picklist value),
but not the API. You can push any value in API.
Controlling and Dependent elds: picklist values can be displayed dynamically based on the value of another
eld. For example, if you choose a country with a picklist, the second picklist can only display the cities of this
country:
Continent is the controlling eld of country
Country is the dependent eld of continent and
controlling eld of city
City id the dependent eld of country

5.3- Given a scenario, determine the appropriate elds and page layouts for custom and standard objects
 Based on the above, you can now determine the appropriate elds and page layouts for di erent objects.

5.4- Explain how to create, delete, and customize record types for custom and standard objects
From Video 9: Record Type is the ability to gather data in di erent ways on the same object (ex. Internal/External
Case), each with di erent elds and process. Record types allow an Admin to
con gure di erent page Layouts, Business Processes and Picklist values to di erent
users based on their pro les, or to the same user with many RT options.

Record Type consists of:

1. Business process (lifecycle): what stages and status? 10 to 50 to 100? For


Lead and Solution: Status, and for Opportunity and Case: Stage.
2. Page Layout (group of elds)
3. Create the Record Type itself and then specify the picklist value of other
picklist elds. This way each RT have di erent picklist for elds.

The user Pro le + Record Type = Page Layout displayed


You need to create all 3 – in this example, Case:

1. Before, go to the eld that you want to add picklist values for: Build | Customize |
Case | Fields | Status | Case Status Picklist Values – add the picklist values
2. Go To Support Processes: Cases | Support Processes – New – name it internal – Select
the picklist values for the Case Status for this Internal Process
Go To Support Processes: Cases | Support Processes – New – name it external –
Select the picklist values for the Status for external process

         

3. Page Layout: internal layout rst: Cases | Page Layout | name it internal and
base it on the existing layout | add the elds you want and remove elds that are not needed. (Before 2,
make sure you created any custom elds you might need in either Record Types)
4. Finally, create the Record Type itself: Cases |Record Types – New – select the Support Process and Pro les
that will use it – next – select the page layout for each Pro le

IMPORTANT: After creating Record Type, you can edit picklist values to
any pickist eld (other than status and Stage, which are the Process).
Finally, add the “Case Record Type” to both pages layouts for the user
to know which type he is having. Now when the pro le user wants to
open a new case, he gets the options on the screenshot! Note that the
description that you put appears here!
The main RT is called Master RT. And all Records that existed before
cresting any RT are part of this Master RT.
Can also remove Lookup elds that allow Related list (bottom section)
You can Edit Record Types assignment in the User | Pro les or
Permission Sets.
A user can see Master RT, or RT1/RT2.
Record types do not in uence record-level security by default. However, they can referenced in sharing rules.

5.5- Given a scenario, determine the appropriate record types and business processes for custom and
standard objects
When you need di erent picklist values based on another elds: no need for RT, use eld controlling/dependent
When you need di erent picklist value based on profuiles: RT is needed
When you need di erent layout based on di erent pro les: RT is not needed, this can be done through Pro le

5.6- Explain the implications of deleting elds


When a eld is deleted, it can be recovered. When a eld is erased, it is permanently removed from Salesforce.
Deleted elds are automatically erased after 15 days if not undeleted.
Before deleting a custom eld, consider where it is referenced. You can’t delete a custom eld that is referenced
elsewhere. For example, you cannot delete a custom eld that is referenced by a eld update or Apex.
When you delete a custom eld, all of the eld history data is deleted and changes are no longer tracked.
A background process periodically runs that cleans up metadata associated with deleted custom elds. This
process will a ect the Last Modi ed Date and Last Modi ed By elds on page layouts, record types, and custom
objects.
Deleted custom elds and their data are stored until your organization permanently deletes them or 15 days has
elapsed, whichever happens rst. Until that time, you can restore the eld and its data. However, the eld still
counts against the maximum number of custom elds allowed in your organization.

5.7- Describe when to use and how to create formula  elds


Same as Excel formula – not stored in SF, but auto updated and
displayed only
Formula often is used with Roll-Up Summary elds. Roll-up with
do math on the child objects.
For example, RSF on the parent that adds the Number of
Registrations
Create Formula eld called “Slots Remaining” enter the
formula among elds that uses the RSF
Example, Job Application is Parent and Review is Child using a
Master-Detail relation (Hiring App)
On the parent, you can create a RSF that counts the number of review that an Application has
Create custom eld of type RSF
Summarized Object is Review, Roll-Up Type=count
Add it to page layout of Application Object
Now create another eld on the Application called “Max Reviews” type number. Make it 100.
Now let’s create a Formula eld to calculate the remaining
Go to Build | Create | Object | Application | Custom elds –
new
Type=formula, and Formula Return Type=number with 0
decimal places
Add this Max_Applications__c – Number_of_Review__c
Add it to layout (next page)
A Cross Object Formula is one that references data in a related record. For instance, I could create a formula eld
on opportunity to display the account’s phone number. When the account’s phone number gets updated, the
eld on opportunity automatically re ects the change. For exaqmple here, the Formula Text eld points to the
formula “$Organization.Name” which displays the name of the company.
Formula elds are read-only (the same is true for roll-up
summary elds) for all users.
For this reason, formula elds will not be displayed when
editing records. The value of the formula is only calculated after the record is saved.
Limitations of Formula Fields:
Cannot reference some eld types, like not limited to: Text (Long), Text (Rich), Picklist (Multi-Select).
Some formula elds cannot be referenced by roll-up summary elds.
When editing formula syntax, there are two types of editors:
The simple editor does not provide access to cross-object formulas or functions
Advanced Formula editor, which exposes cross-object variables and functions

5.8- Extra Notes
Person Account:

Salesforce mainly uses Business accounts, which are used to store information about companies
On the other hand, Person accounts provide a way to represent an individual as both a contact and an account in
Salesforce, and are frequently used to facilitate business-to-consumer (B2C) relationships.
They are used to store information about individual people. For example, online shoppers, gym members,
vacation travelers, or other individual consumers.
They can’t have contacts. Instead, the it stores the information you’d typically save for business contacts
You can treat a person account like a contact: invite a person account to a meeting, associate it with campaign
Enabled via feature request (raising a case with Salesforce).

5 Comments

OSCAR
November 22, 2016 at 11:50 pm

Hi Walid El Hor,

In section “5.4- Explain how to create, delete, and customize record types for custom and standard objects”, you talk about the “video
9”. Could you add the link, please?.

Thank you very much for share all this information!. It is being very usefull for me.

Walid El Horr
November 24, 2016 at 3:23 pm

Oh, my mistake. This was from the Security chapter “Who Sees What” Salesforce video series. I xed it, and here is the link of
the whole series. The record type is the last video in the series:
https://www.youtube.com/watch?list=PL6747B4DAE356E17C&v=jDYfTfaqclk

Glad this is helping

Bilquis Shaikh
April 29, 2017 at 7:52 pm

Great job Walid!! These notes are really helpful..

Anonymous
July 31, 2018 at 5:13 pm

Amazing Notes, Thank you very much

CJ
November 21, 2018 at 12:26 am

I saw your course in Udemy. Your notes are super helpful

Leave a comment
Your email address will not be published.

Name

Email

Website

Post Comment

Powered by WordPress / Academica WordPress Theme by WPZOOM

Вам также может понравиться