+ Start a Discussion
Vijay sidaraddiVijay sidaraddi 

how to make Junction object when we have couple of object

I have three object A, B and C but  i want to make C as my junction object 
where i will define master detail relationship and which one will be hte primary and secondary

amit singh 2096amit singh 2096
Hi Vijay,

The first master-detail relationship you create on your junction object becomes the primary relationship, and the other becomes Secondary.

Hence if you create first master-detail relationship with A  then with B.
So A-C is Primary and B-C is secondary.

William TranWilliam Tran

A many-to-many relationship consists of three objects: Object A and Object B are the two primary objects, and Object J is the junction that enables the many to many.

Object A  <--M/D--  Object J  --M/D--> Object B

So on Object J you need to create two Master-Detail relationships, one that points to Object A and one that points to Object B.

As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.

Amit Chaudhary 8Amit Chaudhary 8
Junction Object

A custom object with two master-detail relationships. Using a custom junction object, you can model a “many-to-many” relationship between two objects. For example, you may have a custom object called “Bug” that relates to the standard case object such that a bug could be related to multiple cases and a case could also be related to multiple bugs.

Salesforce supports 2 kinds of relationships like Master Detail and Lookup. They are both one-to-many relationship, and they are both  defined from the many-to-one side, that is from a child to a parent. They can be made one-to-one relationship by adding validation rules, or maybe triggers to enforce the one-to-one nature, i.e. only one child is allowed.

Junction objects are used to create many to many relationships between objects. If you take the Recruiting application example, you can see that a Position can be linked to many Candidates, and a Candidate can apply for different Positions. To create this data model you need a third object "Job Application" that links the 2.

So you'd create a lookup field for both Position and Candidate object on the "Job Application" object. This will establish many to many relationship between Position and Candidate via the "Job Application" object known as the junction object.

User-added image

Please check below post with  screen shot

Please let us know if this will help you

AMit Chaudhary