What are Objects in Salesforce?
Objects are database tables that allow us to store data specific to the organization in salesforce. There are 2 types of Object i.e. Standard Object and Custom Object.
What is Object Relationship?
Create relationships to link objects with each other, so that when users view records, they can also see related data.
Discuss the types of Object Relationship?
1. Lookup Relationship (1:n)
A lookup relationship field connects a child object to a parent object with one-to-many relationship type. It is a loosely coupled relationship where child record can exists without an associated parent record.
2. Master-Detail Relationship (1:n)
A master-detail relationship field connects a child object to parent object with one-to-many relationship type. It is a tightly coupled relationship where child record can’t exists without any associated parent record.
3. Junction Object (many-to-many)
Junction objects are used for creating many-to-many relationships in Salesforce. Master-Detail relationship acts as a source to form many-to-many relationship. We can create many-to-many relationship using two master-detail relationship linking to the same object, which is known as Junction object.
4. Hierarchical
A special lookup relationship available for only the user object. It lets users use a lookup field to associate one user with another that does not directly or indirectly refer to itself. For example, you can create a custom hierarchical relationship field to store each user’s direct manager.
5. Self Relationship
A self Relationship is a lookup relationship to the same object.
Difference between Master-detail & Lookup relationship?
Master Detail | Lookup | |
Object | You can define master-detail relationship between custom objects or between custom object and standard object(standard object must be the parent) , can not create between two standard object as standard object can never be a child. To create a many-to-many relationship, simply create a custom junction object with two master-detail relationship fields, each linking to the objects you want to relate | You can define a relationship between any two objects, standard or custom |
Cascade delete | When a record in a master object is deleted, all the records in the detail object that are related to that master record will be deleted. | When a parent object is being deleted, you can configure a Chile object to either clear that parent record value in the child record or prevent deletion of the parent record |
Parent Record | All the child record must have a related parent record | The Child record may or may not require a related parent record |
Ownership | The ownership of the child record is determined by the related parent record | Each child record has an owner and is not related to the parent record |
Sharing & Security | The detail record inherits sharing & security from the master record | There is no security or inheritance between related parent & child records |
New relationship with existing child record | To relate an object to another, no records should exits in the child record | To relate an object to another, there is no condition on the number of records |
Roll-up Summary | If you have the roll-up summary field in the parent object, any create, edit or delete action in the child record will trigger an edit action in the parent object If you have a validation rule and other rules in parent object, the validation rules will trigger for the parent object | You can not create the roll-up summary field in the lookup relationship |
Workflow rule | Supports cross object workflow. You can configure a field update action to update a field in the parent record using a value from the child record | Does not support cross object workflow |
Can we convert the lookup relationship to Master Detail relationship?
Yes we can convert a lookup relationship to master-detail relationship.
Can we create Master-Detail relationship on existing records? If yes, explain?
No we can’t directly create master-detail relationship on existing records because the tagging a parent record on child is mandatory, and for existing records it can not be blank.
But there is a way to create a master-detail relationship on existing records:
1. First create a lookup relationship
2. Update the existing records with respective parent record
3. Change the data type from lookup relationship to Master-detail relationship
Examples of Lookup, Master-Detail and Junction object

Well Explained 😀
LikeLike