Object Relationships

[youtube id=iEO6vv3QJYM]

See [link id=1360] for an understanding of how to create object relationships.

20 thoughts on “Object Relationships”

  1. Hi John,

    As mentioned in the video there are some scenario where one contacts can have multiple accounts but only one primary account. Could you please explain that in details with example.

    Thanks..

  2. John:

    I checked the junction object Campaign Member and was expecting to find 2 master -detail fields, one for Campaign and one for Contacts, but only found Lookup fields for Campaign/Contacts.
    Why? According to this piece from SF, a many-2-many requires the junction object to have to 2 master-detail fields, one for each “parent”:
    https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm

    Is this true only for custom objects? Standard objects in a many-2-many will only allow Lookup instead of Master-detail? Thanks

    1. There are some built in relationships in salesforce that don’t act completely standard (e.g. if you re-created the relationship it would not work the same way). Account/Opp is another one. You can create a rollup on account from opp data, despite it being a lookup relationship.

  3. Hi John,
    I have few questions regarding M-D relationships
    I m cosidering this scenatio
    i have 3 objs.
    ObjA ObjB ObjC
    relation ship goes like this
    A-master
    B-Detail

    now further i want to have obj C to b in hierarchical from B

    means Obj A is master B is detail and again i want ot create another relationship that is B is master and C as detail.

    in that case if next step, if i think of going C as master and A as detail, is it possible?
    —————————————————————————————————————————-

    Another question is if in other case ,i have A – standard obj…just want to make sure that standard object can never be detail side .?

    ——————————————————————————————————————————-
    Another question,(a-B0 master detail as primasry for further hirarchy…

    When i have hierarchical relation ship like A master B is detail
    and further B is master and C is Detail………..does the record owner of C will b the record owner A .?
    —————————————————————————————————————————-
    Thank you for your kind support.

    Tejal.

    1. I’d have to test out the first scenario – I don’t think you can set up a relationship like that…

      Standard objects cannot be detail, correct.

      I believe the record ownership would cascade from the grandparent- would suggest double check to be sure, but I believe that is correct.

  4. Is it possible to relate a standard object back to itself using 2 many-to-many lookups in a custom join object? The use case is for displaying a related list for account records of 1 record type in the record of another account record – more specifically account records of each of our retail sales outlets and accounts of our distributor sales channel who also sell to the same accounts in our retail channel. Thanks!

    1. Yes you could create a custom object to establish a many to many relationship between the same object – e.g. an “Account Relationship” object. I don’t believe you can have two master-detail relationships relating to the same object, however. Therefore you would probably need to have a “primary” account on the junction object that was mater-detail and the other relationship would be lookup.

  5. John,
    What relationship is Task to Lead? Is that the same as for Task to Contact? Could either of those pairs be considered a parent-child? Finally, is the schema builder the best place to observe all the different object relationships in an org? Thanks, Chuck

    1. The relationship between task an object is I believe technically considered a lookup – but it isn’t a standard lookup relationship.

      The task can be related to many different objects, whereas a standard lookup field relates specifically to a single object.

      It definitely isn’t a master-detail relationship, as you can’t create rollups based on task data.

      [comment edited for clarity]

Leave a Reply