The 6 Types of Relationships in Salesforce
Data relationships between objects in Salesforce can be a tricky topic to get your head around. You may be faced with a business scenario that requires creating a custom object. Then, the next decision is which relationship types you should use to extend your Salesforce data model.
This is a fundamental concept to learn, as it ensures that you pick the right relationship type that ensures a scalable data model.
Before we dive into the topic in more detail, check out the video below, where Christine explores the different types of data relationships in Salesforce. So, if you’re ready, let’s get started!
1. Lookup Relationships
The lookup is a loosely coupled relationship, allowing you to connect one object to another in a one-to-many fashion.

In this example, you can see that an asset may be involved with a number of cases – if the case is deleted, the asset will remain and vice versa.
2. Master-Detail Relationship
The master-detail relationship is a strongly coupled relationship – meaning if the parent is deleted, so are the child records. This feature can be incredibly helpful; however, it seems to scare people unnecessarily!
Master-detail also allows the parent record to control child record attributes, such as sharing and visibility. The child record inherits whichever security setting you choose for the parent record.
In this example, you have a list of rooms employees can book for meetings. If the room is deleted, what use would the meetings be? None! However, when creating a master-detail relationship, you can check a box to allow reparenting – you could be kind and allow them to select a new room!


The sweet spot with master-detail relationships is that you can create roll-up summary fields! Note that a single object can have a maximum of two master-detail relationships.
Lookups vs. Master-Detail Relationships
Lookup relationship | Master-detail relationship |
---|---|
Loosely coupled. | Strongly coupled. |
Roll-up summary field not available. | Roll-up summary field is available. |
Parent record is not required when creating a child record. | Parent record is required in order to save a child record. |
Lookup fields are not required on the page layout of the detail record but if you make them a required field, it is advised! | Master-detail field is always required on the page layout of the detail record (because of the point above). |
Standard object record can be on the detail side of a custom object in a lookup relationship. | Standard object record cannot be a child. |
By default record ownership of child records is not controlled by the parent. | The parent controls the record ownership of child records. The owner field is not available on the detail record in master-detail relationship queues, sharing rules and manual sharing is not possible for detail records as it requires the owner field. |
You can have a child record without a parent. | You cannot have a child record without a parent. |
You can have a maximum of 40 lookups on an object. | You can have a maximum of two master details on an object. |
No cascade delete. | Cascade delete. |
3. Many-to-Many Relationships
Say you have a situation where it is required you have many of one record related to many of another. Duplicating the lookup field a number of times on each object is not the best practice and will get very messy. This is where we should leverage Junction Objects.
In the image below, we see that a session can have multiple speakers – but speakers can also present at multiple sessions. Adding the “Session Speaker” Junction Object in between is a perfect place to handle this relationship!

4. Self Relationship
Let’s say you have a campaign that is a part of a bigger campaign. You can use a lookup field from campaign to… campaign! But why? This would be a great situation to show how multiple child campaigns relate to the main parent campaign (known as a Campaign Hierarchy).

5. External Relationships
There are two more types of lookups for working with external objects that we should cover briefly:
- Indirect lookup relationships: These allow a relationship to be formed between a Salesforce object and an external object. If your Salesforce org was the family, then the objects would be related but not in the same family. A great example is relating payment records to an account from an ERP system – the ERP system is external to Salesforce, but the records are important. They relate via an external ID to match the payments to the account.
- External lookup relationships: These allow a relationship to be formed between two external objects. Your two friends from outside your group are now in a relationship. Maybe that ERP system links the payment records to a bank account.
6. Hierarchical Relationships
The hierarchical relationship is a simple but commonly forgotten relationship in Salesforce. This unique relationship can only be used on the user object, and is designed to create a hierarchy of users. For example, it could be used to create a lookup field for the user object, which can then be used to list the user’s manager.
Summary
Learning the different types of relationships in Salesforce and when to use them is a core part of any professional job. Hopefully, this article has given you a complete overview of Salesforce relationships and explained when to use them.
Bart Lont
Excellent article! Very helpful.
pjm
Guys….How to create a relationship between existing obejcts? The previous admin set up a C.O with 173 fields unrelated to OPPORTUNITIES.
Baswaraj Tandur
if you want to create MDR relationship between existing objs then –
1. create Lookup r’ship between them
2. Don’t keep any child (secondary) record orphane.
3. Go to lookup r’ship field of secondary obj > Edit> change the type
Jonathan Foerster
Excellent stuff as always Jonathan. This is something that I am bookmarking for future reference.
[email protected]
Very Nice topic, one more reason to be impressed with SFBen team.
Malaikani rajamani
Great clear and short.
Lakshmi
Great article! One quick clarification: You mentioned that you can have a maximum of 40 lookups on an object.
Is this different from https://help.salesforce.com/articleView?id=overview_of_custom_object_relationships.htm&type=5 where it says:
Each custom object can have up to two master-detail relationships and up to 25 total relationships.
Jonathan Fox
Hi!
That article I believe is obsolete.
Check page 239 of this release notes. http://resources.docs.salesforce.com/190/latest/en-us/sfdc/pdf/salesforce_summer14_release_notes.pdf
‘Increased Maximum Number of Relationship Fields
The maximum number of Relationship Fields per object has been increased, from 25 fields to 40 fields.’
You can increase it as detailed here – https://help.salesforce.com/articleView?id=000331427&type=1&mode=1
Shiva
The explanation about External relationship is wrong. An external lookup relationship links a child standard, custom, or external object to a parent external object but here it says it’s between two external objects. Please check and do the needful.
Jonathan Fox
Hi, I agree that when I first wrote this, my final point there is not super clear, however it is not wrong because 2 external objects can be related via an external lookup field.
The point could be clearer and more defined though with some added examples 🙂
Salesforce Standard/Custom Object > External Object —— External Lookup
Salesforce Standard/Custom Object > External Object > External Object —— External Lookup
Sam
How to BIFORGET 40 look up relationship in each object that mean how many self relationship or hierarchical relationship in each object
BIDtravel
Well done clarifying this essential subject!
I just would suggest that when using indirect lookup, the child record will be the external object, and the Salesforce object, the parent
Mangesh
Where is the 3rd Point.. ?
Vinod K
Hi Fox,
You didn’t mention 3rd type of relationship, take a look and keep posting more.
All the best.
stephen
solid!
Hilal Faizaman
This was a really good. One thing however I felt that was missing was the Polymorphic relationship. Thats when the referenced object can be of multiple types. A good example is the WhoId field on the Event and Task objects.
yakub
Great article thanks for best resource
Ashish
Good work ! Appreciate it.
Martin Vyskocil
As Hilal suggested, polymorphic relationship should have been included. Additionally, there are Special Lookups between certain standard objects as well, ie Opportunity looks up to Account and rollup summary is available.
shubham bagal
good explanation!
difference between lookup and master detail is the best part…
Jeanne Vie Garciano
Very informative! Thank you
Nazeer
In a self relationship (Account) is there any limit or concern if we decide to have 20K plus records choose one account record as parent?
Christine Marshall
Check out the Salesforce doc on considerations for relationships: https://help.salesforce.com/s/articleView?id=sf.relationships_considerations.htm&type=5
Euromillones
The clarity of the information is appreciated. And thanks for sharing.
Arrify
Great job, Jonathan! Your article on the 6 types of relationships in Salesforce is extremely helpful. Your clear and detailed explanation of each relationship type makes it easy to understand the different ways to connect records in Salesforce. This will be a valuable resource for anyone looking to enhance their knowledge of this complex topic. Thank you for sharing your expertise!
Shane Bakerhart
Lookup relationships can in fact have cascade delete, but you need to contact support to turn the feature on. Then it’s super easy to use and very handy.
https://help.salesforce.com/s/articleView?id=000382017&type=1
Greg Ernst
Isn’t the hierarchy relationship also used for Account hierarchy?