What Is Salesforce Relationship?
Salesforce Relationship is a 2-way association between 2 objects. By creating relationship fields, we can link objects with each other and we can make connections and display data about other related objects. There can be only 40 custom Relationships fields on a single object.
Relational database
- To create a relationship between two tables. We use the concept of primary key and foreign key.
- The primary key resides on the table which is one in a many-to-one relationship.
- Foreign Key resides on the table which is many in a many-to-one relationship.
In Salesforce
- To create a relationship between two objects, we use relationship fields.
- The field is created on the many-side object and it is related to the one-side object.
Types Of Relationship In Salesforce
In Salesforce, several types of relationships can be established between objects. Here are some of the most common ones:
1. Master-Detail Relationship In Salesforce
Master-Detail Relationship is a parent-child relationship between two objects where the detail side object depends on the master object. When the record of the master object is deleted, all the related detail side records will also get deleted. A child record cannot exist without a parent record.
2. Lookup Relationship In Salesforce
Lookup Relationship is a relationship where one object has a reference to another object without any dependency. Unlike a master-detail relationship, the child object can still exist even if the parent object is deleted.