Do you want to create a junction object in salesforce? I will also explain how to create a junction object in salesforce. We will also discuss, how to create a custom junction object in salesforce. Also, we will cover these topics.
- What is a junction object in salesforce
- How to create a junction object in salesforce
- How to create junction object in salesforce lightning
- How to create junction object in salesforce classic
- How to make junction object in salesforce
- How to create a custom junction object in salesforce
What is a junction object in salesforce
A junction object in salesforce is defined as a single term that can be called a custom object with two master-detail fields.
The salesforce permits the use of junction object that enables many-to-many relationship. It is the type of custom object that permits the link between one custom object or one instance to many children’s records, every child can identically link to many parents.
The junction object is used in which we can link custom objects with many child records and join every child record to many parent objects.
Now we have understood Junction Object, let’s move ahead and see how to create junction object in salesforce. We will explore both the salesforce experiences: Salesforce lightning and Salesforce Classic.
How to Create junction object in salesforce
Let’s see the best practices for the creation of the junction object in salesforce:
The junction object is a many-to-many relationship. It is a custom object with Two Master-Detail fields on it.
The first master detail created on the junction object is called Primary Master.
The second master detail is created on the junction object called the secondary Master.
Whoever is the owner of the primary master will be the owner of the corresponding junction (child records).
If we delete any one of the master records the child record will also be deleted.
The child record cannot be deleted if the master record has more than 200 child records.
The Junction object cannot be the master to any of the other objects.
Furthermore, let’s learn how to create a junction object in salesforce lightning.
Read How to Create Records in Salesforce
How to create junction object in salesforce lightning
Salesforce Lightning is a modern view of the salesforce platform that is fast, easy, and filled with a wide variety of options.
Here we are creating the Junction object that is USA student to group.
Follow the below steps on how to create a junction object in salesforce lightning:-
Step-1: Create the custom object, Go to the Setup and click on the Object Manager.

Step-2: After clicking on the Object Manager, the object manager page is open. click on create and then click on the custom object.

Step-3: After clicking the custom object in salesforce there will be a label option. For the label, enter USA student. After entering the label there is a Plural Label option. For Plural Label, enter USA students. After that, you can see that the Object Name and Record Name are automatically filled.

Step-4: After filling in all the entry wizards scroll to the bottom of the page and select the checkbox Launch New Custom Tab Wizard after saving this custom object and then click on the save option.

Step-5: On the Page of the New Custom Object Tab, there is a Tab Style field click on the field and select a style you like.

Step-6: Click Next, Next, and Save.

Step-7: After creating the USA student object in salesforce, we create one more object called the USA group. This object is created as same as the USA student object.
Now we are creating a relationship. for creating this we are creating another object that is a junction object.

Step-8: After entering the object name enter the Record Name label and Format. The Datatype is in the form of Auto Number. Fill in the display format and starting number. After that Allow the search and click on save.

Step-9: After creating the junction object now we are creating a field and relationship for the junction object. Click on the field and relationships option that is present on the left sidebar.

Step-10: After clicking on the field and relationships, now click on the Master-Detail Relationship custom field and then click on next.

Step-11: Now we are choosing the related object as a USA student for the new relationship. The USA student is our primary master. After selecting the object click on next.

Step-12: After selecting the primary master, enter the label and name for the lookup field. The label is USA student and the field name is USA_student. After entering both clicks on next.

Step-13: Click Next, Next, and then Add the custom related list, and after that click Save & Next option.

Step-14: Clicking on the field and relationships and then click on the Master-Detail Relationship custom field and then click on next.

Step-15: Now we are choosing the related object as a USA group for the new relationship. The USA group is our secondary master. After selecting the object click on next.

Step 16: After selecting the primary master, enter the label and name for the lookup field. The label is USA group and the field name is USA_group. After entering both clicks on next.
Click Next, Next, and then Add the custom related list, and after that click Save & Next option.

This is how we understand how to create junction object in salesforce lightning.
How to create junction object in salesforce classic
Salesforce classic is the traditional user experience of salesforce and before the salesforce lightning was introduced, it was the only salesforce experience.
Follow the below steps on How to create a junction object in salesforce classic:-
Step-1: Firstly login to the salesforce account, and then scroll to the bottom of the page you can see that on the left side there is a build option under the build option there is a create option, and click on the create drop-down sign.
After clicking on the Create drop-down menu there will see an objects option click on objects.

Step-2: After clicking on the objects the Custom Objects page will open, and there is a New Custom object option click on it.

Step-3: After clicking on the New Custom Object there will be a label option. For the label, Project USA. After entering the label there is a Plural Label option.
For Plural Label, enter Projects USA. After that, you can see that the Object Name and Record Name are automatically filled then click on save & Next. This Project USA is the Primary master.

Step-4: After selecting the Save&Next. Now create the secondary master object, there will be a label option. For the label, Developer USA. After entering the label there is a Plural Label option.
For Plural Label, enter Developer USA. After that, you can see that the Object Name and Record Name are automatically filled then click on save & Next.

Step-5: After selecting the Save&Next. Now create the junction object, there will be a label option. For the label, Assignment USA. After entering the label there is a Plural Label option.
For Plural Label, enter Assignment USA. After that, you can see that the Object Name and Record Name are automatically filled then click on save.

Step-6: After creating the junction object, now create the tab for the primary master object.
Scroll to the bottom of the page you can see that on the left side there is a build option under the build option there is a create option, and click on the create drop-down sign.
After clicking on the Create drop-down menu there will see a tab option click on the tab. The custom tab Page is open, click on the New option.

Step-7: After clicking on the New option, the New custom object tab page is open then select the object. Here we are selecting the primary master object Project USA then select the tab style and after that click on the next option.

Step-8: After choosing the tab, click Next, Next, and then Save.

Step-9: Now creating the secondary tab, again click on the New option, New custom object tab page is open then select the object. Here we are selecting the secondary master object Project Developer then select the tab style and after that click on the next option.

Step-10: After choosing the tab, click Next, Next, and then Save.

Step-11: Now creating the junction tab, again click on the New option, New custom object tab page is open then select the object. Here we are selecting the junction object Project Assignment then select the tab style and after that click on the next option.

Step-12: After choosing the tab, click Next, Next and then Save.

Step-13: After creating the tab click on the junction object, After clicking on the object, Go to a custom Fields & Relationships and click on the New button.

Step-14: After clicking on the New option, the New Custom Field page is open, select the master-detail relationship custom field and click on next.

Step-15: Now select the other object to which the object is related and click on the next option.

Step-16: Enter the Field Label and Field Name for the lookup field. After entering both clicks on next.

Step-17: Click Next, Next, and then Add the custom related list, and after that click Save & Next option.

Step-18: After clicking on Save&Next, Field and Relationships page is open then click on the data type Master-Detail Relationship and then click on next.

Step-19: Now select the other object to which the object is related and click on the next option.

Step-20: Enter the Field Label and Field Name for the lookup field. After entering both clicks on next.
Click Next, Next, and then Add the custom related list, and after that click on the save option.

So, with this, we understand how to create a junction object in salesforce classic and now you proceed with the further actions on how to make a junction object in salesforce.
Read How to Use Chatter in Salesforce
How to make a junction object in salesforce
The salesforce permits the use of junction object that enables many-to-many relationship. The First Master Detail created on the junction object is called Primary Master. The second Master Detail is created on the junction object called the secondary Master.
Follow the below steps on How to make a junction object in salesforce:-
Step-1: From the setup, search for the schema builder in the Quick Find Box. By simply typing schema builder.

Step-2: Create a new object by simply clicking on the element tab that is present in the left sidebar. After clicking on the element tab then drag the object onto the canvas.

Step-3: Create the object you want and enter the information to define your object.
For the label, USA Project. After entering the label there is a Plural Label option. For Plural Label, enter USA Projects. After that, you can see that the Object Name and Record Name are automatically filled then click on Save.

Step-4: Create the USA Employee and USA Project Task as same we created in step three.

Step-5: After creating the objects, drag-drop the Master-detail field onto the USA Project task object and fill in all the details and click on the save button.

Step-6: Again drag-drop the master detail onto the USA Project task, this time create a relationship between the USA Project task and USA employee. Fill in all the details and click on the save button.

Step-7: After saving the Master-Detail Field you can see that the relationship between the objects is created through the junction object.

So, in this way we have learned how to make junction object in salesforce.
Read How to Create a Task in Salesforce
How to create a custom junction object in salesforce
Junction objects create a many-to-many relationship between the salesforce objects. Costco is a retail company that is establishing a new branch in Washington, USA and they are hiring new employees. For this, they are using the Junction object.
Follow the below steps on how to create a custom junction object in salesforce:-
Step-1: From the setup, search for the schema builder in the Quick Find Box. By simply typing schema builder. The schema builder option is shown, click on that.

Step-2: Create a new object by simply clicking on the element tab that is present in the left sidebar. After clicking on the element tab then drag the object onto the canvas.

Step-3: Create the object you want and enter the information to define your object. For the label, Applicant. After entering the label there is a Plural Label option.
For Plural Label, enter Applicants. After that, you can see that the Object Name and Record Name are automatically filled then click on Save.

Step-4: Create one custom object as job position and also created a junction object called job application same as we created above.

Step-5: Drag-Drop the master-detail field onto the job application(junction object) for creating a many-to-many relationship between the custom object(Applicant).

Step-6: Again drag-drop the master-detail onto the Job Application, this time create a relationship between the Job Application and Job Position. Fill in all the details and click on the save button.

Step-7: After saving the Master-Detail Field you can see that the relationship between the objects is created through the junction object.

This is how we understand how to create custom junction objects in salesforce.
Conclusion
In this tutorial, we have learned how to create junction object in salesforce, and also we have covered how to create custom junction object in salesforce. This can be performed on both salesforce lightning and salesforce classic.
- What is a junction object in salesforce
- How to Create junction object in salesforce
- How to create junction object in salesforce lightning
- How to create junction object in salesforce classic
- How to make a junction object in salesforce
- How to create a custom junction object in salesforce
You may like the following salesforce tutorials:
- How to Import Data into Salesforce
- How to Create a related list in salesforce
- delete schema builder in salesforce
- How to Create Record Type in Salesforce
- How to Create a Campaign in Salesforce
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.