1

as everybody knows ,in salesforce we use lookup relationship when we want to relate multiple parent records to the child record. can any one give me some examples about this kind of relationship? thanks beforehand

3
  • Might be worth going through the Trailhead on Object Relationships. It has helpful diagrams as well as examples that might assist your learning.
    – Mark Pond
    Nov 29 '16 at 22:05
  • actually I read Trailhead and then came here
    – Rickey
    Nov 29 '16 at 22:37
  • 1
    The examples you give in the comments on the answer below are perfect examples of a junction object that represents a many-to-many relationship (an object with multiple lookups / child with more than one parent). Gym, Gym Membership, Member; Student, Enrollment, Class; Order, Order Line Item, Product; Is there some part of identifying a many-to-many relationship that you need clarification on?
    – Mark Pond
    Nov 29 '16 at 23:26
0

I suspect there may be some confusion here. Multiple parents typically applies to when there are parents that are different objects from one another. When that happens, you'll have a ParentObjectName__c field on the child record for each object that the child record has a lookup relationship with.

Now, if you're asking about multiple parents from the same object, that's a very different story. It's something that can become quite unwieldy to manage which is also probably best avoided where possible. In that situation, ideally one would use custom lookup fields for each parent record as in Parent1__c, Parent2__cand Parent3__c.

While these relationships can frequently be identified through queries using the "parent-child" relationship, it would be impossible to do that when there are multiple related parents for an object as that query expects to only find a single parent.

What you describe would more likely be a case of having multiple related records as in ObjectRecord__r, which is perfectly fine to have.

2
  • can you please describe it for an order object and a product object (I consider junction table too) . or for a Gym and it's Members (and membership as their junction table)
    – Rickey
    Nov 29 '16 at 22:59
  • What you're asking of me is far too broad and beyond the scope of this forum. If you have a specific question about a particular schema, please feel free to ask it in a new question. You asked for examples of parent-child relationships where there could be more than one parent without mentioning junction objects or describing exactly what you wanted to know more about.
    – crmprogdev
    Nov 30 '16 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.