Posted on 20th May 2022 by Akshay Kalaskar
Salesforce has three main types of relationship fields, each having its own unique set of features.
When designing the data model of an application, it is very important to determine what type of relationship fields to use, based on the type of data that will be stored in the fields.
The table below shows a feature-wise comparison of the different types of relationship fields in Salesforce, along with some scenarios that would help you to determine what type of field to choose in which scenario…
| Feature/Comparison | Lookup Relationship | Master-Detail Relationship | External Lookup Relationship |
|---|---|---|---|
| What is the meaning of these fields? | Used to link two objects together so that you can “look up” one object from the related items on another object. | This is a parent-child relationship in which the master object controls certain behaviors of the detail object. | Used when you want to connect a child object to a parent External Object from a third-party system. |
| Is a parent required for creating children records? | |||
| Can rollup values to parent records using rollup summary fields? | |||
| Relationship to Parent Record | Parent record is not required while creating a child record. | Parent record is always required to create a child record. | If parent record is uploaded with External Id then child record need to be connected with parent External Id. |
| Presence of fields on the page layout | Parent fields are not required on the page layout of the detail record. | Parent field is always required on the page layout of the detail record. | External Id is required import of the record. |
| Relationship with Standard Objects | Standard object record can be on the child side of a custom object. | Standard object record cannot be a child. | Standard object can be on the child side of an external lookup relationship. |
| Record Ownership | Record ownership of child records is not controlled by the parent. | Parent controls the record ownership of child records. | |
| Max. number of fields that can be created of the given type | 40 | 2 | 25 |
| When to use this type of relationship in Salesforce? | Lookups are generally for use where you may or may need to have a relationship between two objects (but not always). | Master Detail relationship is used when we want to control the display of detail records based on the value in the master record. | External Lookup Relationships are used when you want to connect a child object to a parent external object. |
Now that we are familiar with the types of relationship fields in Salesforce, along with the scenarios where to use them, let us go back to our drawing boards and decide the right type of fields to choose to link one object in Salesforce with a different object.
Happy designing!!!
