Describe the Salesforce object relationship types and the key differences between them.
Suggested answer
Lookup Relationship: Loosely coupled. The lookup field is optional; deleting the parent does not cascade-delete children (options: clear field, restrict delete, or cascade delete — configurable). Children have their own OWD and sharing settings. Does not support Roll-Up Summary (RUS) fields. A record can have up to 25 lookup relationships.
Master-Detail Relationship: Tightly coupled. The parent controls sharing and security of the detail. Deleting the master cascades deletes all detail records. Supports Roll-Up Summary fields (COUNT, SUM, MIN, MAX) on the master. The master field is required. Up to 2 master-detail relationships per object.
Many-to-Many (Junction Object): Implemented via a custom junction object with two master-detail relationships to each of the related objects. Enables querying records on either side of the relationship.
Self-Relationship: A lookup on an object to itself (e.g., Account.ParentId). Used for hierarchies.
Hierarchical Field: A special lookup available only on the User object, allowing users to reference other users above them in a hierarchy (e.g., Manager field).
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.