Junction objects are used for creating many-to-many relationships in Salesforce. Salesforce by default supports one-to-many relationships. These are the Master-Detail, the Lookup and the External Lookup relationships. They are defined from the many-to one side, meaning from a child to a parent.
These relationships can be changed to one-to-one relationships. The way to do this is through addition of validation rules, or by using triggers to implement the one-to-one type. This means only one child is allowed for one parent.
How to Create Many-to-Many Relationship
Junction objects are useful for creating multiple relationships across items under two objects.
Take the Recruiting application for instance. Here, you see that a certain position can be linked to many applicants. Now, with the use of a junction object, you can link every Applicant to different positions available in your company. In this model, the junction object (Job Application, for example) functions as the linkage between the objects Applicant and Position.
To implement this many-to-many relationship, create a lookup field for both Applicant and Position on the Job Application object.
So here are the steps:
Create the junction object – You need to customize an object so that it can later on be used as the junction object. Steps in customizing an object for this purpose differ from edition to edition.
Create two master-detail relationships – You need to verify first if the objects to be related already exist.
Customize the related lists – Check the page layouts of master objects for the lists.
Customize reports – The objective for this is to maximize the effectiveness of the relationships.
The ability to create many-to-many relationships is available only in the following editions: Salesforce Classic, Lighting Experience, Group, Contact Manager, Enterprise, Professional, Developed, Unlimited, Performance and the Database.com.
User needs to acquire first the Customize Application permission before they can create many-to-many relationships.