Activity Forums Salesforce® Discussions Explain Junction relationship (Many to Many ) in detail in salesforce.

  • Nikita

    Member
    September 12, 2019 at 7:58 am

    Hi Laveena,

    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 relationships between Position and Candidate via the "Job Application" object known as the junction object.

  • Achintya

    Member
    September 12, 2019 at 9:43 am

    You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship allows each record of one object to be linked to multiple records from another object and vice versa. For example, you create 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. When modeling a many-to-many relationship, you use a junction object to connect the two objects you want to relate to each other.

    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 create 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.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos