What is a Junction Object in Salesforce?

Share this article...

Salesforce provides multiple types of relationships in order for you to connect objects together in different ways.

You may be familiar with the two main relationship types lookup relationships, and master-detail relationships. These allow you to create a normal parent and child relationship, which is sometimes referred to as a 1 to many relationship. This means there is only ever 1 parent but multiple child records can be associated. However, what happens when you need to connect “many” parents to “many” child records, let’s take a look…

Salesforce Junction Object

Salesforce Junction Objects give you a way to create a many-to-many relationship between Salesforce objects. They are created using a custom object and then relating two other objects via two master-detail relationships. This is necessary when modeling certain data schemas, let’s dive into a couple of examples…

Junction Object Examples

Take a recruitment process where you have a job position and candidate object. As it is a requirement for candidates to apply to multiple job positions, a standard parent-child relationship would not work. You need a Junction Object, called something along the lines of ‘Application’ in order for many candidates to apply to multiple job positions.

There is also an example within standard Salesforce objects with Opportunity Products. If you want to assign Products to a certain Salesforce Opportunity, you will need to use the Opportunity Line items object (a Junction Object). This is required as without the Junction Object, you would only ever be able to associate one product, to one opportunity.

Creating a Junction Object

Creating a Junction Object is simple, and once you’ve created your first one, the concept will become second nature. I’m going to use the recruitment process example from above to makes things simple…

1. Firstly, make sure that you have available the two objects that you wish to connect with a Junction Object. I’m going to create two custom objects, Candidate, and Job Position. As you can see from the Salesforce Schema Builder, these are currently disconnected, but to ensure that many candidates can apply for many jobs, we need our Junction Object.

2. The next step is to create a new custom object that will serve as our Junction Object. I’ve created a custom object called “Job Application”, that will enable us to connect the Candidate & Job Position objects.

3. We now need to create our two master-detail relationships on the Job Application object, one will need to connect to our Candidate object, the other to Job Position. You can do this by creating a field as normal on your Job Application object, and navigating to the master-detail relationship field type, and selecting our other objects. If we go back to the Schema Builder, we can see our many-to-many Junction Object is complete!

From the above setup, we are now able to assign many candidates, to many job positions. Let’s have a look at how this looks inside of Salesforce…

Salesforce Example

As you can see in the below image, the Junction Object has enabled more than one individual to apply for this Salesforce Admin position…

It also allows the individual to apply for multiple job positions within the company…


That’s all there is to it! Junction Objects are a core element in understanding how the Salesforce data model works. It’s vitally important to understand not only for your Salesforce Admin Certification but in order to build scalable solutions in the future. Happy solutionizing!

14 thoughts on “What is a Junction Object in Salesforce?

    1. Christine Marshall


      Hi Mark,

      Was there anything in particular you felt would have been useful? When you say “security” do you mean the sharing model etc?

      Best, Christine

  1. Hi Christine,

    Using the example above, if a user has read access to Candidate object but not to Job Position, if we create the Junction Object, will the user be able to have read access to the Job Position? Sort of security inheritance for objects that the user have no access to. Thanks.

    Best Regards,

    1. When you grant access to the junction object (e.g. via the profile), when you select it, it will automatically select the two parent objects too and won’t allow you to save unless the profile has read access to all 3 objects.

    1. Christine Marshall


      Hi Ken,

      For users to be able to see Application records, they would need to be granted a minimum of Read access via their profile. When you select Read access against Applications, it will automatically select Read access on Job Position and Candidate. If you remove Read access from Job Position or Candidate, it will automatically remove Read access from Applications too!

      Hope this helps!

  2. If we build connection between two parent objects with Lookup relationship or one lookup and another master-detail relationship, wouldn’t it still be called junction object??

  3. Hello Everyone

    I would like to know if in the example, is possible to create a record of Job position is possible to create a Candidate using all the relationships or the Candidate must be previously created?

Add Comment