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

DEV 401:

Building Applications with Force.com and Visualforce

Application Essentials:
Building your Data Model

Instructor: Parikshith

Field Types
Standard Fields associated with a Custom Object
Date Auto Number
ID

Created By
Last Modified By
Created Date

Last Modified Date


Owner

Data Model
Custom Objects
Custom Fields
Custom Relationships

Object Relationships
Two Main Types
Lookup
Master-detail

Two Special Types


Self
Many to Many

Lookup Relationships
Loosely Coupled
Child field value may be optional
No cascade delete
Independent ownership & sharing
Max 25 lookup relationships per child

Master-Detail Relationships
Tightly Coupled
Child field value is always required
Cascade delete
Inherited ownership & sharing
Maximum 2 master relationships per
detail object

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.

Relationships and Reporting


Relationship
Type

Standard Report Types

Report Type
Category

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 lookup


Object 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 object
Secondary master object with junction
object and primary master object

Primary master object


and Secondary
master object

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 relationship
allows developers to create a manager field on the UserObject to relate another user

Many to Many relationship


Allow for the relationship of two objects in a many to many
fashion
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

Junction Objects
When modeling a many-to-many relationship, you use a
junction 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.

Exercise Creating a custom junction object


Goal:
Create a Many-to-Many Relationship between Position
and Candidate Using a Junction object Job
application

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 built
on Force.com platform and describe the differences
between them

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