6 - Object Relationships (Lookup and Master-Detail and Junction Objects)
- Get link
- X
- Other Apps
Here's a tabular comparison of the Lookup and Master-Detail relationship types in Salesforce:
| Feature | Lookup Relationship | Master-Detail Relationship |
|---|---|---|
| Definition and Usage | Loosely coupled; records are linked but can exist independently | Tightly coupled; child record depends on the parent for existence |
| Data Integrity and Ownership | Child record does not inherit parent’s sharing or ownership | Child inherits sharing, permissions, and ownership from the parent |
| Roll-up Summary Fields | Not available | Available; aggregates values from child to parent |
| Required Field | Optional; child can exist without a parent | Required; child must have a parent |
| Cascade Delete | Optional (not automatic) | Automatic; deleting parent deletes all related child records |
| Security and Access | Child has independent sharing settings | Child inherits sharing settings from the parent |
| Hierarchy Depth | Flexible; supports multi-level relationships | Limited to strict parent-child hierarchy with up to two relationships |
This structure provides a quick reference to understand when to use each relationship type based on your data needs in Salesforce.
-----
Standard Master-Detail Relationship: Often, a Master-Detail relationship exists directly between two objects, where one is the parent (master) and the other is the child (detail). For example, a custom "Invoice" object can have a Master-Detail relationship with a "Customer" object, where each invoice must be related to a customer.
Junction Objects for Many-to-Many Relationships: A junction object is specifically used when you need to create a many-to-many relationship between two objects. In Salesforce, direct many-to-many relationships aren’t supported natively, so you use a third custom object (junction object) with two Master-Detail relationships to the two other objects. This junction object lets records from two different objects relate to each other in a many-to-many manner.
- Get link
- X
- Other Apps
Comments
Post a Comment