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
Anujmorning batch ThapliyalAnujmorning batch Thapliyal 

when to use masterdetail and lookup relationship

I want to know situations where I should use Masterdetail or lookup relationship
snehal surti 3snehal surti 3
Master detail relationship should be used when the relation is tightly coupled means where child records existence depends on parent. In which case even permission to child record visibility is controlled by parent. So if object A and object B had master detail relationship then if someone has read write permission on parent record they get access to child record as well. For example you have customer holding bank account at bank and account and bank account details are 2 different objects. Now if customer account is deleted then it doesn't make sense to keep bank account details. This Is perfect case for master details. 

Lookup relation is more loosely coupled and child's existence doesn't depend on parent. In look up relation child record has complete separate permission and record visibility. For example country object which is look up on customer's address doesn't need to drive it's permission by account object as country object can be related to multiple other object where address detail is available. Country object which holds all country data is independent of any other oobject but let's say you add provinces as object and then it makes sense to have relation between province and country to be master detail because if you delete country it doesn't make sense to keep its provinces. Make sense?