A Relationship is a way in which two or more people or things are connected with each other. The way they connected will be of different types likewise in salesforce there are 6 different types of relationships in salesforce.
- Master-Detail relationship
- Look Up relationship
- Many-to-Many relationship
- Self-relationship
- External relationship
- Hierarchical relationship
Master-Detail relationship :
Master-Detail relationship is a type of relationship, one object acts as a master and the other acts as a detail object. In other words, this relationship acts as a parent-child relationship. We use this type of relationship when we want to bound two objects tightly or closely dependent on each other.
Important Points Regarding Master-Detail relationship
- In Master-Detail Relationship the “child object” or “detail object” must have a parent.
- Roll-up Summary fields can be established.
- Records can be re-parented.
- Standard objects can not be a detailed object
- Maximum 2 Master-Detail Relationships can be created for an Object.
Look Up relationship :
Look Up relationship is a type of relationship in which that if one gets deleted then the related object will not get deleted.
Important Points Regarding look Up Relationship
- When a parent’s record gets deleted, the child remains in existence.
- We cannot create a roll-up summary field in a lookup relationship.
- The relationship is optional.
- No impact on Security.
Many-to-Many relationships:
In Many-to-Many relationships, records of particular objects are linked to multiple records of different objects and vice versa. There is no such field as a many-to-many relationship in Salesforce, we can create a many-to-many relationship by creating two master-detail relationships with a common object.
Important Points Regarding Many-to-Many relationships Relationship
- A Junction Object is used to create Many-Many Relationships.
- A junction object can also be called a Join Object.
Self-relationship:
Self-relationship simply means creating a relationship with itself. In this, we can relate an object with itself by look-up.
External relationship:
In External lookup relationships, it allows a relationship to be formed between two external objects. It supports standard look-up relationships that use 18 characters Salesforce Id for the association.
Hierarchical relationship:
This unique relationship can only be used on the user object and is designed to create a hierarchy of users.