class 5_designing applications.pdf
TRANSCRIPT
-
8/10/2019 Class 5_Designing Applications.pdf
1/13
Instructor: Parikshith
DEV 401:
Building Applications with Force.com and Visualforce
Application Essentials:
Building your Data Model
-
8/10/2019 Class 5_Designing Applications.pdf
2/13
-
8/10/2019 Class 5_Designing Applications.pdf
3/13
Data Model
Custom Objects
Custom Fields
Custom Relationships
-
8/10/2019 Class 5_Designing Applications.pdf
4/13
Object Relationships
Two Main Types
Lookup
Master-detail
Two Special Types
Self
Many to Many
-
8/10/2019 Class 5_Designing Applications.pdf
5/13
Lookup Relationships
Loosely Coupled
Child field value may be optional
No cascade delete
Independent ownership & sharing
Max 25 lookup relationships per child
-
8/10/2019 Class 5_Designing Applications.pdf
6/13
Master-Detail Relationships
Tightly Coupled
Child field value is always required
Cascade delete
Inherited ownership & sharing
Maximum 2 master relationships per
detail object
-
8/10/2019 Class 5_Designing Applications.pdf
7/13
Lets Compare..Lookup and Master-Detail Relationships
Lookup Relationships Master-Detail Relationships
Up to 25 allowed per object Up to 2 allowed per object
Parent is not a required field Parent field on child is required
No impact on security and access Access to parent determines access to
children
No impact on deletion Deleting parent automatically deletes children
Can be multiple layers deep Can only be one layer deep (a child of one
master detail relationship cannot be parent of
another)
Lookup field is not required on the
page layout
Lookup field on page layout is required
Note: Both relationship types look almost the same on a page layout: both
include a lookup field for the one side and related list for the many side.
-
8/10/2019 Class 5_Designing Applications.pdf
8/13
Relationships and Reporting
RelationshipType
Standard Report Types Report TypeCategory
Lookup Object by itself Object with first lookup
Object with second lookupObject with
third lookup
Based on the object
Master-Detail Object by itself with first lookupObject with second lookup
Object with third lookup
Master Object
Many to Many Primary master object by itself
Secondary master object by itself
Primary master object with junction
object and secondary master objectSecondary master object with junction
object and primary master object
Primary master object
and Secondary
master object
-
8/10/2019 Class 5_Designing Applications.pdf
9/13
Self Relationships
A self relationship is a lookup relationship to the same object
Example: It is possible to create a lookup relationship
from position to position
The user object has a special type of lookup relationship the
hierarchy relationship. For example, a hierarchy relationshipallows developers to create a manager field on the User-
Object to relate another user
-
8/10/2019 Class 5_Designing Applications.pdf
10/13
Many to Many relationship
Allow for the relationship of two objects in a many to manyfashion
Candidates may apply for many positions by submitting
a job application for each position
A position many have many candidates apply Implementing a many to many relationship requires
-
8/10/2019 Class 5_Designing Applications.pdf
11/13
Junction Objects
When modeling a many-to-many relationship, you use ajunction object to connect the two objects you want to relate
to each other
A junction object is a custom object with two master detail
relationships
When creating a junction object, consider the following:
Name the object with a label that indicates its purpose.
Use the auto-number data type.
-
8/10/2019 Class 5_Designing Applications.pdf
12/13
Exercise Creating a custom junction object
Goal: Create a Many-to-Many Relationship between Position
and Candidate Using a Junction object Job
application
-
8/10/2019 Class 5_Designing Applications.pdf
13/13
Module Review
Examples of Custom field types
True or False. If an a field is set to universally required,
users will be required to populate it when loading data
through the API.
List the four types of custom relationships that can be builton Force.com platform and describe the differences
between them