Notes
Salesforce provides various types of relationships to define how objects interact with each other. The key types are:
-
Lookup Relationship:
- A loosely coupled relationship between two objects, where the parent and child objects maintain their independence.
- Example: Relating a Contact to an Account.
-
Master-Detail Relationship:
- A tightly coupled relationship where the child object is dependent on the parent object. If the parent is deleted, the child is also deleted (cascading delete).
- Example: Relating Opportunity Products to Opportunities.
-
Many-to-Many Relationship:
- Achieved through a junction object, allowing multiple records of one object to relate to multiple records of another object.
- Example: Relating Campaigns to Contacts using Campaign Members.
-
Hierarchical Relationship:
- A special relationship type only available on the User object. It allows users to relate to other users, such as in an organizational hierarchy.
- Example: Defining a manager for a user.
-
Self-Relationship:
- A relationship where an object is related to itself through a lookup relationship.
- Example: Creating a hierarchy of employees where each employee relates to a manager