2

My question is... We normally create master-detail relationship to achieve many to many relationship. Instead of using master-detail relationship on junction object can i use lookup relationship to achieve same.

2 Answers 2

5

Yes you can.

A downside is that unlike when you use master-detail relationships, the junction object will not be automatically deleted when one or both of the objects it is relating are deleted. You can add your own logic to deal with that though.

1

You can achieve the many to many relationship using lookup relationship but as the function with master detail relationship when parent record is deleted its child are also deleted this wont happen in lookup relationship. Even if You make the lookup field in lookup relationship required then when you delete parent record it will give an error as it is been used in junction Object . Its better to have Masterdetail relationship on junction Object to have many to many relationship, that even when the parent record is deleted that relationship also get deleted in junction Object. To know more about many to many relationships,follow this link : https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm&language=en_US#JORelatedList

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .