
Hello, do you want to know about “How to Create Many to Many Relationship in salesforce?”. In this post, we will discuss about Many to Many Relationship in salesforce, Create Many to Many Relationship in salesforce, How to Create Many to Many Relationship, How to Create Many to Many Relationship in salesforce classic.
Many to Many Relationship in Salesforce
Object Relationships in Salesforce: In this Salesforce tutorial, we will learn how to create a many-to-many relationship in Salesforce and what is M:M Relationship is.
What is Many to Many Relationship in Salesforce?
In a many-to-many relationship, one record of one object is associated with many records of another object, and vice versa.
So how do we create Many-to-Many relationships on Salesforce.com? We don’t have fields in Many-to-Many relationships with Salesforce. We create a Many-to-Many relationship by creating two master-detail relationships on a common Junction object. Junction object is a key term used in creating many-to-many relationships.
What is Junction Object in Salesforce?
In Salesforce, a Junction Object is a custom object used to connect a record instance with multiple child records and multiple child records with the same records.
Example:- A company-customer relationship is a many-to-many relationship because a company can sell a product to many customers and a customer can buy a product from many companies.
How to create Many to Many Relationship?
Let’s learn how to create many-to-many relationships in Salesforce. To create a M:M relationship in salesforce, we first need to create a Junction Object.
Creating Junction Object in Salesforce.
To create a Junction object in Salesforce, go to Setup | Build | Create | Objects | New.
Click the new button to create a new object. Enter the label name and Plural label as shown below.

Click on the Save button.
How to create Many to Many Relationship in Salesforce| M:M?
In this salesforce tutorial, we will create a many-to-many relationship between an invoice object and a Pharma product object. Since we have already created a Pharma Product Invoice junction object, create a Many-to-Many relationship between Pharma Product (parent object) and Junction Object (child object), Invoice Object (parent object) and Junction Object (child object).
Click here:- Learn how to create master detail relationship in Salesforce.

As shown above, we have create a to master Detail relationship in child object (Junction Object).

Here we create multiple invoices in one product and multiple products in one invoice.
Conclusion
Here we clearly understood the How to create Many to Many Relationship in Salesforce. In our upcoming Salesforce tutorials, we’ll learn How to create Schema Builder in Salesforce.