function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vijay sidaraddiVijay sidaraddi 

how to make Junction object when we have couple of object

HI
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

Thanks
Vijay
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.

Regards,
Amit
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.

Thanks
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.
https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm#JOJunctionObject


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.
https://developer.salesforce.com/docs/atlas.en-us.fundamentals.meta/fundamentals/adg_relationships_many_relationship.htm

User-added image

Please check below post with  screen shot
http://www.jitendrazaa.com/blog/salesforce/deep-drive-in-junction-object-create-many-to-many-relationship-in-salesforce/

Please let us know if this will help you

Thanks
AMit Chaudhary