Pages

Wednesday, 3 February 2016

Difference B/W lookup and master detail relationship


The key difference is master-detail has a direct dependency between the objects:

  • You cannot have a detail record without a master.
  • The detail record inherits sharing rules from the master.
  • You cannot update the relationship to the master in a master-detail relationship.
  • The number of master-detail relationships you can use are limited.
  • You cannot set profile object permissions for a detail record
  • Master-detail relationships are automatically included in report record types 

When you delete the master it will cascade delete all detail records relating to that master. A typical use of a Master-Detail would be the classic Sales Order and Sales Order Items objects. 

  • Lookups are generally for use where you may or may need to have a relationship between two objects (but not always).
  • Lookups are generally used to reference commonly shared data, such as reference data.
  • Lookups are used to link two objects together when you don't want the behaviour of the master-detail - particularly around sharing rules, profile permissions and cascade delete.
  • Lookups are used when you need to relate multiple 'parents' to the detail record.

You can change between a master-detail and a lookup after you create the field. My recommendation is always start with a Lookup relationship and then if you decide you need the features of a master-detail change it. If the detail object has it's own tab then you probably want to use a lookup not a master-detail.

No comments:

Post a Comment