Author - StudySection Post Views - 446 views
Relationship

Difference between Master-detail and Lookup relationships

Master-Detail Relationship:

  • It is a tightly coupled record that has a direct dependency between the two objects. It can also be described as a parent-child relationship.
  • The record of detail cannot be created without a master.
  • The sharing rules are inherited from the master to the detail record.
  • We cannot update the relationship to the master in a master-detail relationship.
  • The number of master-detail relationships that can be used is limited to 2.
  • Master-detail relationships are automatically included in report record types.
  • We also cannot set the profile object permissions for the record of detail.
  • If a master record is deleted then the record of its detail also gets deleted along with it, that is, it implements cascade delete.
    Roll-Up Summary can be created on a master detail.

Lookup Relationship:

  • This type of relationship can be used when we just need to have the relationship between two objects but not a direct dependency on each other.
  • This is a loosely coupled relationship.
  • These are used to reference commonly shared data, such as reference data.
  • The maximum number of lookup relationships in a field can be 40.
  • They are used to link two objects together when we do not want to have the behavior of the master-detail like sharing rules, profile permissions, and cascade delete.
  • Lookups are used when we need to relate multiple ‘parents’ to the record of detail.
  • Deletion of the parent just deletes the related field in the child but not the whole record.
  • This type of relationship is also like a one-to-many relationship.

We also have another type of relationship, External Lookup Relationship which creates a relationship to link a Salesforce object to another external object. This external object is any object whose data is stored outside the Salesforce org. This also behaves similarly to Lookup Relationships.

For example,
In a delivery service company, a delivery schedule needs to be always linked to a delivery location. If we remove a delivery location from our list, then all the related delivery schedules should also be deleted automatically. This kind of dependency can be achieved through a Master-detail relationship between the delivery location and delivery schedule Salesforce objects.

If we take the above scenario only, then a delivery agent can have multiple deliveries to complete. So a single agent can be linked to multiple deliveries, and the deliveries can look up to the same agent.

The Salesforce lookup relationship has no relation with other records. It does not depend on any other objects, whereas a master-detail relationship has an association with other records.

On the other hand, the lookup relationship is just a reference. It can be even blank or NULL. In the database, we can pull the data from particular fields based on the reference keys easily.
lookup

jQuery presents a tree-like structure of all the elements on a webpage simplifying the syntax and further manipulating such elements. The jQuery Certification Exam by StudySection will secure your fundamental knowledge and a basic understanding of jQuery as an asset to improve your skills.

Leave a Reply

Your email address will not be published. Required fields are marked *