Junction Object in Salesforce

A junction object is a Salesforce object that contains many-to-many relationships between two related objects.

What is a Junction Object in Salesforce?

If you want to create the many-to-many relation then we need to use the Junction object in Salesforce. A junction Object is a type of custom object which allows linking two custom objects.

A junction Object in simple terms can be called a custom object with two master details fields

Junction Object Examples

For example, Let us assume that we have two Objects – Contact and Room. To provide the many-to-many relationship between the Contact and the Room, we will need to create one more object let’s say it would be Reservation, it will be called a junction object.

Junction Object Examples

Relationship Types in Salesforce

Let’s see how many types of relationship type in Salesforce.

  1. Master-Detail Relationship: One Object is considered as the Master and the other as the Detail. If you delete the record of the Master Object, the information of the Detail Object will get deleted automatically.
  2. Look-Up Relationship: The Objects in a Look-Up Relationship are connected loosely. It means that if you delete the record of an Object, it will not impact the linked Object.
  3. Many-to-Many Relationship: Records of a particular object can connect with various records of different objects and vice versa.
  4. Self Relationship: It means an Object is creating a relationship with itself. 
  5. External Relationship: This field is used to connect the external Object with another external object. 

Steps to create a Junction Object in Salesforce

Check the below session from min 46:00 to learn about junction objects.

YouTube video

Junction Object Interview Question

Try below and find the answer to the Junction Object Interview Question. Don’t forget to share the answers in comment

  1. As a user, you will able to see junction records in Salesforce when you don’t have read access on one parent record.
  2. What happened to the junction record when someone deleted the one-parent record?

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 460

7 Comments

  1. 1. As a user, you will able to see junction records in Salesforce when you don’t have read access on one parent record.

    ANSWER : The primary object permission will be apply to junction object, So the junction object permission is read only.

    2. What happened to the junction record when someone deleted the one-parent record?

    ANSWER: If we delete any one of the master records the corresponding child records will get deleted too.

  2. If the record has two master records in a many-to-many relationship, the user must have read access to both master records.” to view junction object’s record.

    • What about is the user doesn’t have access to one of the parent records? He will be able to see the record?

  3. Hi want to learn master detail relationships and how its applied or used in salesforce . could anybody pls give me some links to podcasts which are very explanatory.

  4. 1. As a user, you will able to see junction records in Salesforce when you don’t have read access on one parent record.
    ans:=won’t be able to View the Junction Object.

    2.What happened to the junction record when someone deleted the one-parent record?
    the junction object remains in the system.because 2nd parent will act as primary parent.

Leave a Reply

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