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
AljebouriAljebouri 

creating relationship between different objects

Dear All,

I want to have three objects linked in a realtionship as below

1. I have Object A, B and C
2. I want to build 1 - 1 realtion between A and B
3. i want to build many to many realtion betweeb B and C
4. in object A Layout i want to have related list contains data from Object C

can you help on how i can achieve above?

Regards,
​Ahmad
PratikPratik (Salesforce Developers) 
Hi Ahmad,

Salesforce provides One to Many relationship through either Lookup or Master-child relationship.

To have Many to Many relationship, you can creat a Junction object as a child for the objects in which you want to have many to many relationship.
https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm&language=en_US

To have One to One relationship there is a workaroud:
http://salesforce.stackexchange.com/questions/7282/how-to-create-a-one-to-one-relation-between-two-objects

To have any object as a related list. it should be at the child level of the other object as a master. in your case, you will have to create a relationship between A & C , with C as a child.

Thanks,
Pratik
 
AljebouriAljebouri
Thank you so much, so how I can show related list of object C in object A if A has one to one relation to B and B has many to many relation to C?
PratikPratik (Salesforce Developers) 
Hi Ahmad,

A & C should have parent child either lookup or master child, where C being child.

A & B should have master detail, B being detail/child.

Many to Many: there should be some object lets say D which should have 2 master detail with B & C as master and D as child.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.