Salesforce

Field RelationShips in Salesforce

Master Detail Relationship

Also known as parent-child relationship.

Child Object Records cannot exists without parent record that means master detail relationship field is mandatory field on child objects page layout.

Properties and behaviour of child object records are controlled by parent object records.

When to Create Master Detail Relationships ?

When you want child object record to be deleted when its associated parent record get deleted.

 For Ex: Student and School objects •When child record cannot exist without parent.

It is one to many.

Points To Remember

Master detail relationship in salesforce is achieved by creating master detail type field on child object which is linked to parent.

Whenever master detail relationship is created, child object records owner field gets deleted and its owner is derived from parent record.

Sharing and security of parent object record is inherited by child object records.

Allow reparenting checkbox.(unchecked by default).

Standard object cannot be on detail side of master detail relationship

Lookup Relationships

Child record can exists without parent, that means, lookup field is not a mandatory field on child object.

Field is created on child object.

Owner is not changed.

Sharing and securities not inherited. It is one to many.

Types of Lookup Relationships

Self Relationship

A lookup relationship referring to same object.

Example: Employee referral field on Employee object

Hierarchical  Relationship

A Self lookup relationship on user object


Important Point

You Cannot create master detail relationships on existing object if records already exists. You have to create a Lookup relationship first, populate lookup fields with data in all records and then change the relationship type to Master-Detail.

Please check below video for detailed explaination :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s