Salesforce Object Relationships | Master-Detail, Lookup.

Salesforce Object Relationships : In this Salesforce Tutorial we are going to learn about different Salesforce object Relationships like master-detail relationship, Lookup Relationship. In our previous Salesforce Tutorial we learned about different salesforce field types. In this lecture we are going to create master-detail relationship, Lookup Relationship between different  objects.

Salesforce Object relationships.

Salesforce Object relationships is nothing but a two way association between two Objects. One Object record information is linked in another object record. In Salesforce.com, Object Relationships is created between two Object. Here the custom field of an Object record contains a link in another object record. To build many custom object in Salesforce.com, relationships plays a major role.

In Salesforce.com, Relationships are used to fetch data from other object records. Here the parent ID is stored in pre-defined relationship.

ADVERTISEMENT
Salesforce Object Relationships

Types of Salesforce Object Relationships.

The Salesforce object Relationships can be divided in to Two types. They are

  1. One to Many (1:M) :- One parent record is associated to many child records. Basically it forms the parent-child relationships. A parent object can have many child’s objects but a child object must have only one parent object.
    1. Master-Detail Relationship:-
    2. Lookup Relationship.
  2. Many to Many (M:M).

Master-Detail Relationship in Salesforce.

  • Master-Detail relationship is a one type of relationship which form tight bond relationship between Parent object and Child object.
  • Child records should always associated to a parent they can not remain orphan.
  • Cascade record deletions. When a parent object record is deleted all it’s child records get deleted automatically.
  • Standard Objects cannot be a detail object(Child object). ex: Account cannot be detail object.
  • The master-detail relationship fields is required on the page layouts of the detail object.
  • Roll-up Summary fields can be created on Master object(Parent Object.)
  • Child record inherits all security and sharing settings from it’s parent record.

Lookup Relationship in Salesforce.

  • Lookup relationship is a one type of relationship which form loose bond relationship between Parent object and Child object.
  • In lookup Child record need not be associated to a parent.
  • No Cascade record deletion happens.
  • Lookup field is not required on the page layouts of the detail object.
  • No Rollup summary fields can be created in Lookup relationship.
  • Doe’s not inherit any settings from it’s parent record.

Many to Many Relationship in Salesforce.

One record of One object is linked to multiple records of another object and vice versa. In Salesforce.com, We create Many-to-Many Relationship by creating two master-details relationship with a common Junction Object.

What is Junction Object in Salesforce?

In Salesforce, Junction Object is custom object which is use to link one instance of a record to many child records and many child records to on records equally.

Example:- The relationship between a company and a Customer is many to many relationship because a company can sell a product to multiple customers and a customer can purchase a product from multiple companies.

Conclusion.

Here we clearly understood different Salesforce object relationships. In our upcoming Salesforce Tutorials, we will learn about how to Lookup relationship fields, Master-detail Relationship and Many-to-Many relationship in Salesforce.