Activity Forums Salesforce® Discussions How To Create Many To Many Relationships Between Object?

  • shariq

    Member
    September 20, 2018 at 3:13 pm

    Hi,

    Creating Many to Many relationship in salesforce is little tricky. You cannot create this type of relationship directly. Follow below steps to create this type of relationship.
    Create both objects which should be interlinked.
    Create one custom object (also called as junction object), which should have auto number as unique identification and create two master relationships for both objects, no need create tab for this object.
    Now on both objects, add this field as related list.

    Thanks

  • Parul

    Member
    September 20, 2018 at 6:28 pm

    Adding some points;

    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.

    Hope this will help you.

    Thanks

  • shariq

    Member
    September 20, 2018 at 10:24 pm

    Hi,

    Adding Example -

    Like many products have same price and same product can be of different prices, its kind of many to many relationship.

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos