Free Salesforce Admin Tutorial >

Chapter 4 - Data Modelling >

Relationship in Salesforce

Relationship in Salesforce

What You’ll Learn

S2 Labs

Salesforce is a powerful cloud-based platform for managing data, streamlining the sales process, sales & marketing alignment, tracking analytics, customer behaviour and performance. So, it’s a very huge platform catering to multiple business challenges. When we talk about the relationship in Salesforce, we mean the different data objects.

These objects (company, name, etc) are crucial for maintaining a unified and comprehensive view of your organization’s information. In this blog, we’ll explore the concept of relationships in Salesforce, focusing on the various types of relationships, including lookup, master-detail, and external lookup relationships.

What is Relationship in Salesforce

Relationships in Salesforce refer to the connections between different data objects within the platform. These relationships enable you to associate and link records, facilitating a structured and organized approach to data management.

Salesforce offers various types of relationships, including master-detail and lookup relationships, which play a crucial role in building and maintaining data relationships for comprehensive data analysis and reporting. Here is a simple example for you to understand relationships in Salesforce: 

Imagine your Salesforce org as a puzzle, with each piece representing a different aspect of your business, such as customers, products, and orders. To see the complete picture, you need a way to connect these puzzle pieces. Relationships in Salesforce serve as the glue that holds your data together and enables you to access related information effortlessly.

Salesforce Admin Training

Types of Relationships in Salesforce

Salesforce offers several types of relationships to establish connections between objects:

Lookup Relationships in Salesforce

  • A lookup relationship creates a connection between two objects, where one object has a field that references the other object’s record.
  • Use lookup relationships when you want to link two objects but don’t require the parent object to control the behaviour of the child object.
  • Subtypes of lookup relationships are Hierarchical and Self relationships.

Master-Detail Relationships in Salesforce

  • A master-detail relationship is a stricter form of connection where one object, the master, controls certain behaviours and permissions of the detail object.
  • Use master-detail relationships when you need more control over related records, such as enforcing data consistency and security.

For a better understanding of the key differences between Lookup and Master-Detail relationships in Salesforce, we will discuss them briefly in the table below:

Lookup relationshipMaster-Detail relationship
It is loosely coupled.It is strongly coupled.
The Roll-up summary field is not available.The Roll-up summary field is available.
Parent record is not required when creating a child record.Parent record is required to save a child record.
Lookup fields are not required on the page layout of the detail record. In case you make them a required field it is advisable. Master-Detail field is always needed on the page layout of the detail record.
Standard object record can be on the detail side of a custom object in a lookup relationship.Standard object record cannot be a child.
The record ownership of child records is not controlled by the parent by default.The parent controls the record ownership of the child records. The owner field is not available on the detail record in master-detail relationship queues. Also, the sharing rules and manual sharing  is not possible for the detail records as it requires the owner field. 
It is possible to have a child record without a parent.It is not possible to have a child record without a parent.
It can have a maximum of 40 lookups on an object.It can have a maximum of two master-detail on an object. 
No cascade delete.Cascade delete can be done.

External Relationships

In terms of working with external objects there are two more types of lookups that we should cover briefly:

Indirect Lookup Relationships

  • These allow a relationship to be formed between a Salesforce object and an external object. 
  • An example of this would be relating payment records to an account from an ERP system. They relate via an external ID to match the payments to the account.

External Lookup Relationships in Salesforce

  • An external lookup relationship links a Salesforce custom object to an external object in an external data source.
  • Use external lookup relationships when you want to access data stored outside of Salesforce while still maintaining relationships with Salesforce records.

Setting Up Relationships in Salesforce

Creating relationships between objects in Salesforce is relatively straightforward:

  • Log in to your Salesforce org and go to the Setup menu.
  • In the Quick Find box, type “Objects” and select “Objects and Fields.”
  • Select the object for which you want to create a relationship.
  • Scroll down to the “Custom Fields & Relationships” section and click “New” to create a new custom field.
  • Choose either “Lookup Relationship” or “Master-Detail Relationship,” depending on your requirements.
  • Follow the prompts to specify the related object and other settings. For lookup relationships, you’ll need to define a related list for the parent object to display related child records.
  • After configuring the relationship details, save your changes.
Salesforce Training

Benefits of Relationships in Salesforce

Establishing relationships between objects in Salesforce offers several advantages:

  • Relationships ensure that related data is accurate and consistent throughout your Salesforce org.
  • Users can easily access and view related information without navigating between multiple records.
  • You can automate processes, such as record updates or calculations, based on related data changes.
  • Relationships help you define who can access or modify related records, enhancing data security.
  • Relationships enable you to create meaningful reports and dashboards that provide insights into your organization’s performance.

In Salesforce, relationships are the key to unlocking the full potential of your data. Whether you’re connecting customer data to sales opportunities or linking products to orders, understanding and utilizing the various types of relationships available in Salesforce can significantly improve your data management and decision-making capabilities. In the next part of this series, we will discuss more about Master-Detail relationships in Salesforce.

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *