Object Relationships in Salesforce

As we know that Objects in Salesforce are nothing but a table which stores information. We can create different custom objects in Salesforce. There won’t be any real use until we connect these objects to build an Application.

The Objects in Salesforce can be connected using 4 relationships. They are:

i) Master-Detail relationship: In this two objects are related where one behaves as a Master and the other object behaves as a Child[Detail]. The Detail object always inherit properties from the Master. In this relationship Parent is always required for a child.

ii) Lookup relationship: In this the two objects are related and there is no Master or Child. Every object has it’s own properties. In this the Lookup field is not required.

iii) Self relationship: A self relationship is a lookup relationship to the same object. Example: If we have a Position object we can create a lookup relationship to the same object.

iv) Many-to-Many relationship: This allows the two objects to be related in a many-to-many fashion. Implementing this relationship we need another object known as Junction Object.

In the above picture two objects [Candidate and Position] has a many-to-many relationship. When doing this we use a custom object to connect the two objects  you want to relate to each other.

The picture given below gives the difference between Master-Detail and Lookup relationships.

Leave a comment