We can establish relationships between objects in salesforce. We can associate one object with another.
For example, we have an object name Hospital(to store information about hospital) and you want to associate it with another object ,Patients (to store information about the details of patients) so that you can associate the Patients records with the hospital record.
These relationship types determines record sharing, data deletion, and required fields in page layouts.
The f ollowing types of relationships can be established among objects in salesforce:
Master detail relationship
Look up relationship
External lookup relationship
Indirect lookup relationship
Many to many relationship
Master- detail relationship :
Strongly coupled(parent record is compulsory).
Parent field is mandatory.
Child is completely dependent on parent.
Upon deletion of parent record,the associated child record will be deleted.
Owner of parent will be default owner of child .
Maximum of two Master details on an object.
Roll up summary is available.
Loosely coupled(parent record is not compulsory)
Parent field is not mandatory
Child is independent of parent
Deletion of parent won't impact child.
Parent and child can have different owners.
Maximum of 40 lookups on an object.
Roll up summary is not available
External look up relationship:
We can create two special lookups on an external object apart from the standard lookup relationship. It allows us to link external object to a parent external object whose data is stored in external data source.
Indirect lookup relationship:
It allows us to link external object to a standard or custom object.
Many to many relationship:
It is a relationship of a combination of two Master detail relationships. You have one junction box (object) a common place where both objects meet .
Example: Hospital will be junction where both doctors and patients meet.
In salesforce , only a user object has this type of relationship where we can create hierarchy of users in organisation.
For example , a user can have his manager, and his manager may have senior manager , and so on till the CEO level.
It is self look up. Creating a look up relationship within the same object is self look up. Connecting with the same object.