What Are the Different Types of Relationships in Salesforce?
- Nov 5, 2025
- 14 min read
Introduction
If you're pursuing training for Salesforce, attending Salesforce administrator classes, or considering enrolling in Salesforce certification courses, one of the foundational topics you’ll learn is how data relates within the system. In this blog post, we will explore the various types of relationships in Salesforce the ones you’ll work with every day as an admin, developer, or consultant. Mastering these relationships is a key part of any Salesforce training, including Salesforce admin training or SFDC training, and will prepare you for real-world scenarios and for passing your certification.
We’ll start with a hook.
Imagine you’re at a large networking event. You meet companies, people, and deals. Some people are from the same company, others move between companies. Some deals involve several companies and many contacts, while others are just single contacts. The way these entities connect is what makes your CRM meaningful. In Salesforce, those connections are modeled by relationships.
In this post you’ll learn:
What “relationships” mean in Salesforce.
The different relationship types (Lookup, Master-Detail, Many-to-Many, Self or Hierarchical, External) with definitions and use-cases.
Practical guidance from your Salesforce administrator classes or Salesforce training classes on when and how to use each.
Real-world examples, diagrams, and step-by-step instructions to apply these in your org.
How understanding these relationships helps you in your Salesforce certification training and in your role as an admin.
Let’s dig in.
What Are Relationships in Salesforce?
In the context of Salesforce, a relationship defines how two (or more) objects (standard or custom) are connected. When you design your data model (as taught in Salesforce admin training or SFDC training), you decide how records of different objects link to each other. These connections determine:
how data is referenced and stored,
how it’s shared and secured,
how roll-up summary fields and reporting work,
what happens when a parent record is deleted or modified.
The official Salesforce documentation describes object relationships as special field types that connect two objects together.
From a training for Salesforce perspective, mastering relationships is critical because your role as a Salesforce administrator (or cert-candidate) requires you to build scalable, maintainable data models not just throw fields all over the place.
In the next sections, we’ll walk through the most commonly used relationship types: Lookup Relationships, Master-Detail Relationships, Many-to-Many Relationships (via Junction Objects), Self-Relationships (or Hierarchical), and External/Indirect Lookup Relationships.
Lookup Relationship
Definition & Overview
A lookup relationship is a more loosely-coupled connection between two objects in Salesforce. In this model, one object (the “child”) has a field that looks up to a record in another object (the “parent”). But importantly, the child can exist without the parent or the lookup field can be null.
Key characteristics:
One-to-many (one parent can be referenced by many children).
The parent record’s existence does not force deletion of the child record when the parent is deleted. The child may remain (though the lookup field may become blank).
The child record has its own owner and security settings (not inherited from the parent).
Suitable when the relationship is optional or when you want flexibility rather than strict enforcement.
Use Case Example
In your Salesforce administrator classes you will often see this scenario:You have a Contact object and a custom object Project. You might create a lookup field on Project pointing to Contact, indicating which contact is the owner of this project. But you do not require that every project must have a contact (it can be blank). If the contact later leaves and is deleted, the project remains (though it might lose the reference). This is a lookup relationship.
Another real-world instance: Suppose you have Invoice records that optionally link to a Campaign. Since not every invoice may be linked to a campaign, you use a lookup.
Step-by-Step: Creating a Lookup in Salesforce (as covered in Salesforce admin training)
Navigate to Setup → Object Manager, select the child object (e.g., Project).
In Fields & Relationships, click New.
Choose Lookup Relationship as the field type.
Select the “Related To” object (e.g., Contact).
Configure field label, name, help text, field-level security, required or not, and page layout.
Save the field. Optionally add the related list to the parent object’s page layout.
Test: Create a child record without selecting a parent → allowed. Delete the parent record → child remains (verify behaviour).
When to Use & Admin Tips
Use lookup when the child can exist independently of the parent.
Use when you don’t need the parent to control sharing or ownership of the child.
Remember: You cannot roll up-summary fields across simple lookup relationships (roll-up summary fields are only for master-detail).
Limit: On custom objects, you can have up to 40 lookup relationships.
From a training for Salesforce perspective, always draw your data model diagram and ask: Will the child exist alone? Could the parent be deleted? Need inherited sharing?
Master-Detail Relationship
Definition & Overview
A master-detail relationship is a much tighter coupling of objects: the “detail” object (child) is strongly dependent on the “master” object (parent). The parent record controls certain behaviours of the child.
Characteristics:
One parent to many children (one-to-many) still, but child cannot exist without a parent record.
Deleting the parent automatically deletes the child records (cascade delete).
Ownership, sharing, and security of the child record is inherited from the parent (child can’t have its own owner).
Supports roll-up summary fields on the master object to aggregate child data (sum, min, max, count).
Limit: An object can have at most two master-detail fields.
Use Case Example
Consider a Project object and a Task object. You might decide that every Task must belong to exactly one Project, and if you delete the Project, all its Tasks are meaningless and should be deleted. Also, you want to show on the Project record how many tasks are completed vs pending (roll-up). This is a classic master-detail scenario.
Another example: Quote (child) under Account (parent). If the account is deleted, you may want all quotes to go too (depending on the business). The Salesforce administrator class will highlight that in master-detail, detail inherits the parent’s record ownership so you don’t need separate sharing rules.
Step-by-Step: Creating a Master-Detail Relationship
Setup → Object Manager → Select the detail (child) object (e.g., Task).
Fields & Relationships → New → Choose Master-Detail Relationship.
Choose the master (parent) object (e.g., Project).
Define field label/name, required status, help text, field-level security, page layout.
On save, choose what happens on delete (cascade delete).
Add related list on the master object’s page layout if desired.
Test: Try creating a child without the master → not allowed. Delete the parent → child records gone. Create roll-up summary on master.
When to Use & Admin Tips
Use when child’s existence is absolutely tied to parent.
Use when you need inherited sharing, ownership controlled by parent.
Use when roll-up summaries are needed.
Be careful: Changing a lookup to master-detail later can be tricky if child records have orphans or ownership issues.
In your Salesforce certification training, you’ll often be asked scenarios: if you need roll-up summary, what relationship do you choose? answer: master-detail.
Always diagram and ask: does this object make sense on its own? Will it be orphaned? Does it require parent’s security?
Many-to-Many Relationships (via Junction Objects)
Definition & Overview
A many-to-many relationship exists when multiple records of one object relate to multiple records of another object. For example: a Student can enroll in many Courses, and a Course can have many Students. In Salesforce, you cannot directly create true many-to-many, but you implement it using a junction object, which joins two master-detail relationships.
How it works:
Create a custom junction object (say, Enrollment).
It has two master-detail fields: one to Student, one to Course.
That way, one course can have many enrollments and one student can have many enrollments, hence many-to-many.
Additional fields on the junction can store metadata about the relationship (e.g., Enrollment Date, Grade).
Use Case Example
In a training for Salesforce course, you might see: Contact and Campaign many-to-many relationship. A contact can be part of many campaigns, and a campaign can have many contacts. So you create a junction object Campaign Member with master-detail to both Contact and Campaign, and maybe a field like “Role in Campaign”.
Another real scenario: Product and Opportunity. A product can be on many opportunities; an opportunity can include many products. Junction object called OpportunityProduct (or OpportunityLineItem) links them.
Step-by-Step: Implementing Many-to-Many via Junction Object
Decide the two objects you want to relate many-to-many (e.g., Student, Course).
Create a new custom object Enrollment.
On Enrollment, create a master-detail field to Student.
Also in Enrollment, create a master-detail field to Course.
Optionally create fields to capture metadata (EnrollmentDate, Status).
On Student page layout show related list of Enrollments; same for Course.
To see many-to-many, you can create a report showing Students and Courses via Enrollments.
Test: Add multiple enrollment records linking same student to various courses and same course to many students. Delete a student → all related enrollments deleted; but course remains (or vice versa).
When to Use & Admin Tips
Use when you have “many of A relate to many of B” requirement.
Use when you might need additional fields about that relationship (meta-data).
Be aware: Since each junction is a master-detail to each parent, delete parent cascades to junctions. Plan accordingly.
In your SFDC training, this concept often confuses folks; practice drawing the diagram: A ↔ Junction ↔ B.
Use descriptive naming: the junction object should clearly reflect the linking meaning (e.g., Enrollment, Subscription, Assignment).
Use roll-up summaries on parent objects if needed for aggregated data via the junction (through the detail side).
Self-Relationship (aka Hierarchical or Same-Object Relationship)
Definition & Overview
A self-relationship exists when a record in an object relates to another record within the same object. You essentially point to yourself. There are two variants:
Lookup to same object (custom).
A special hierarchical relationship type for the User object (built-in).
The hierarchical relationship on User allows you to link a user to their manager (another user).
Use Case Example
Suppose you have a Policy object in an insurance company. You may want to link simpler policies to a “master” policy – so the same object Policy has a lookup to Policy. This is a self-relationship.
For the User object: you might set up a manager field so that each user can have another user as their manager. That’s a hierarchical relationship standard for users.
Step-by-Step: Creating a Self-Lookup Relationship
Setup → Object Manager → select the object (e.g., Policy).
Fields & Relationships → New → Lookup Relationship.
Related To: select the same object (e.g., Policy).
Set field label (e.g., “Parent Policy”).
Field‐level security, page layout, save.
Test: On a policy record, select another policy as parent. You can build a tree of policies.
For the User object hierarchical relationship: In Setup → Customize → Users → Fields you’ll see a “Manager” field (or create one of type Hierarchical).
When to Use & Admin Tips
Use when you need self-referencing hierarchies (e.g., parent-child within the same object).
Use when having one object but you want to show dependencies between records of that object.
For many self-lookups, ensure you guard against circular relationships (A points to B; B points back to A) via validation rules.
In your Salesforce administrator classes, draw an org chart: User (Manager) → User (Subordinate). That’s hierarchical.
Ensure your page layouts show the related list for children (e.g., on the parent side show “Child Policies”).
External Lookup & Indirect Lookup Relationships
Definition & Overview
When your org integrates with external systems, you might need relationships between Salesforce objects and external data sources. Salesforce supports two types of external relationships: External Lookup and Indirect Lookup.
Indirect Lookup Relationship: Links a Salesforce object to an external object by matching an external ID field.
External Lookup Relationship: Links two external objects together or an external object to a Salesforce object.
These relationships are less common for purely admin tasks, but if you are doing data integration or advanced implementations (which you’ll learn in advanced Salesforce certification courses), you’ll encounter them.
Use Case Example
Say your company has an ERP system outside Salesforce that stores Order records externally. You want to link each OrderPayment record in Salesforce to the Order record in ERP. You create an indirect lookup relationship from Salesforce object Payment__c to the external object Order_Ext__x (via external ID). So your training for Salesforce should cover: this is how you model external data relationships.
Another example: Both Order and Shipment live outside Salesforce and you use External Lookup relationship to connect them, and then surface them in Salesforce via External Objects.
Step-by-Step: Conceptual Steps
In Setup → Create External Object (or configure integration) that maps to external system.
On a standard/custom Salesforce object create a field of type Lookup Relationship to the external object (or vice versa) and specify the external ID.
Configure field mapping and make sure external system’s ID is used to match.
Use Salesforce Connect or other integration tools to sync.
Test: You should be able to view external object records as if they are in Salesforce and see the relationship in related lists.
Note: Roll-up summary fields and some standard features may not work the same with external objects.
When to Use & Admin Tips
Use when you have large volumes of data in external systems and you want live or near-live access in Salesforce without full data import.
Ensure performance considerations: external lookups may affect query performance. In your Salesforce training classes you’ll learn to monitor and index appropriately.
Document mapping and governance: since external relationships may affect data access outside-completely in Salesforce, security review is key.
Recognize that many Salesforce certification courses will mention external relationships as part of the data modelling domain for advanced admins.
Comparison of Relationship Types
Here is a handy table summarizing key differences:
Relationship Type | Child Record Depends on Parent? | Deletes Cascaded? | Inherits Security from Parent? | Roll-up Summary? | Use-Case |
Lookup | No | No | No | No | Flexible link; optional |
Master-Detail | Yes | Yes | Yes | Yes | Tight control; dependent child |
Many-to-Many (via Junction) | Many-to-many via junction | Depends (parent deletion) | Depends (junction inherits) | Can via junction | Complex linking of two objects |
Self / Hierarchical | Yes (within same object) | Varies | Varies | Varies | Self referencing hierarchy |
External / Indirect | Varies | Varies | Varies | Typically No | External system integration |
In your Salesforce certification training and Salesforce administrator classes, you’ll often be tested on which type to pick based on scenario. Always think: Is the child independent? Do I need aggregation? What happens if parent is removed?
Real-World Scenarios & Best Practices from Admin Training
Scenario 1: You’re tasked with designing a “Membership” feature for a gym in Salesforce.
You have Member object and Class object (gym classes). A member can attend many classes; a class can have many members.
This is a many-to-many requirement. So you create a junction object ClassAttendance or Enrollment. That object has two master-detail fields: one to Member, one to Class.
You also add fields like DateAttended, Status.
Reporting: You create report “Members by Classes” via the junction.
This scenario would be covered in a Salesforce admin training or Salesforce training classes when modelling many-to-many.
Scenario 2: You need to model a Reporting hierarchy for users.
You use a hierarchical relationship on User object (Manager field).
A user record has a lookup to another user record (their manager).
For the home page you create a report showing “Team members under Manager”.
This would be included in Salesforce administrator classes under user hierarchy and role management.
Scenario 3: You need to link orders from an external ERP system into Salesforce.
You create an external object ERP_Order__x.
You create a custom object Payment__c in Salesforce and link via an indirect lookup to ERP_Order__x on external ID.
This enables you to view payments inside Salesforce context along with order info still residing in ERP.
This scenario may show up in advanced Salesforce certification training or in SFDC training focusing on integration.
Scenario 4: You decide that each InvoiceLineItem always belongs to an Invoice, and deleting an invoice should delete all its line items and aggregate the total.
This is a master-detail relationship: Invoice (master) → InvoiceLineItem (detail).
On Invoice you add a roll-up summary field “Total Line Item Amount”.
All sharing and ownership of line items are inherited.
This scenario aligns with best practices taught in Salesforce training for admins when choosing relationship types.
Best Practice Tips
Diagram your objects and relationships before you build. It saves time.
Ask: Can the child exist without the parent? If yes → lookup; if no → master-detail.
Use junction objects for many-to-many, don’t attempt to fudge by duplicating lookup fields.
Limit the number of master-detail fields per object (max 2). If you hit that you may need to reconsider design.
Avoid circular dependencies (especially with self-relationships).
Consider future data volume and performance: lookups for large volumes may need indexing, selective filters.
Test deletion workflows: what happens when parent gets deleted? Ensure expected behaviour.
Leverage roll-up summary fields only when using master-detail relationships.
Document your relationship model in your Salesforce org – it helps in audits, team hand-offs, certification study.
Why This Matters for Your Salesforce Certification Courses & Administrator Training
If you are enrolled in Salesforce certification courses or taking Salesforce administrator classes (for example via H2K Infosys), mastering relationships is non-negotiable. Here’s why:
Data modelling is a core part of the Salesforce Admin (and Platform App Builder) exam syllabus.
Many scenario-based questions hinge on whether you pick the correct relationship type. e.g., “Which relationship allows roll-up summary fields?” → master-detail.
In your training for Salesforce jumps into flows, triggers and dashboards, understanding how objects relate is critical for cross-object formulas, reporting, sharing rules.
In real-world admin roles, incorrect relationships cause data integrity issues, orphaned records, performance problems. The training ensures you avoid those pitfalls.
Your ability to build scalable and maintainable systems for your employer is enhanced when you know which relationship to use and when.
When applying for roles, you may highlight in your resume: “Designed data model with lookup and master-detail relationships, and many-to-many junction objects in Salesforce org of 200K records.” That’s tangible.
If you ever see a training module that says “Relationships in Salesforce”, you now know it’s not just lookups vs master-detail it includes many facets (self, external, junction).
Visual Diagram (Conceptual)
6
(Use this in your notes from your Salesforce admin training – it will help you visualise how each relationship works.)
Common Mistakes & How to Avoid Them
Mistake: Using a lookup when you really need roll-up summary fields.Fix: Use master-detail if you need aggregate fields.
Mistake: Changing a lookup to master-detail after building many child records.Fix: Plan ahead. Clean up orphan data before conversion.
Mistake: Designing many-to-many without a junction object and using many lookups instead.Fix: Use junction object to keep model clean and scalable.
Mistake: Forgetting about cascading deletes in master-detail and accidentally losing child data.Fix: Always test deletion. Use data export/test org.
Mistake: Self-relationship causing infinite loops (record pointing to itself).Fix: Add validation rule to prevent parent = child.
Mistake: External lookup relationships causing performance issues because external source is slow.Fix: Minimise queries, index external ID fields, use caching when possible.
How This Fits into Your Salesforce Training Path
If you are attending courses such as administration training for Salesforce, or SFDC training, or taking up Salesforce certification courses (for example via H2K Infosys), here’s how you’ll use this topic:
In your foundational module (“Introduction to Salesforce Admin”): you’ll learn what objects, fields, and relationships are.
In the “Data Modelling & Management” module: you’ll dive deeper into types of relationships and their use-cases.
In “Reporting & Dashboards”: you’ll see how relationships impact what related lists you can pull into reports, how roll-up summaries work, how child records show in parent related lists.
In “Automation (Flows/Process Builder/Triggers)”: you’ll need to reference related objects (e.g., when a detail record is created). Understanding relationship direction and behaviour is essential.
In the certification exam: expect scenario questions like: “Your child object needs to inherit sharing from parent and you need aggregate totals. Which relationship?” → Master-detail.
On the job: as a Salesforce administrator you’ll model real business processes: linking accounts to contacts, campaigns to contacts, custom objects to standard ones, etc. If you built this in your training/training for Salesforce properly, you’ll be ahead.
Key Takeaways
Relationships in Salesforce connect objects and determine how data behaves, is shared and reported.
Lookup relationships are flexible, loosely coupled; child can exist without parent.
Master-detail relationships are tight; child depends on parent; supports roll-up summary fields and inherited sharing.
Many-to-many relationships require a junction object connecting two objects via two master-detail relationships.
Self-relationships/hierarchical let one record in an object reference another record in the same object.
External and indirect lookups link Salesforce objects to external data sources—important for integration scenarios.
In your training for Salesforce (including Salesforce administrator classes, SFDC training, Salesforce certification courses) mastering these relationship types is foundational and will serve you well in exams and real work.
Always ask: Can the child exist alone? Do I need roll-ups? What happens on delete? — this will guide relationship choice.
Diagram, test, iterate: avoid common mistakes like incorrect relationship type, unexpected cascades, poor performance.
Conclusion
Understanding the different types of relationships in Salesforce is one of the most valuable skills for any aspiring admin or someone attending training for Salesforce. Whether you are in Salesforce administrator classes, SFDC training, or taking Salesforce certification courses (for example with H2K Infosys), learning how to apply lookup, master-detail, many-to-many, self and external relationships gives you the power to build smart, scalable data models. Start applying what you’ve learned here: log into a sandbox, create a few relationships, test the behaviour, and solidify your understanding.
Ready to take the next step? Enroll in a full Salesforce admin training course and build your first data model today.




Comments