Monday, November 12, 2012

Salesforce: Master-Detail relationship

Some new Salesforce admins may confuse with the different between Master-Detail relationship with Lookup relationship, since both are used to link an object to another object, and you can use parent-child relationships in SOQL queries for both relationship.

But fundamentally, it is different between Master-Detail with Lookup relationship, few items you need to notice on Master-Detail relationship:
  1. When a record of the master object is deleted, its related detail records are also deleted.
  2. The owner field on the detail object is not available and is automatically set to the owner of its associated master record.
  3. The detail record inherits the sharing and security settings of its master record.
  4. The master object field is always required in the page layout of the detail record (in child object).
  5. By default, records can’t be re-parented in master-detail relationships. However, administrator can set to allow child records in master-detail relationships on custom objects to be re-parented to different parent records, by enabling Allow re-parenting check box in the master-detail relationship definition.
  6. You can define master-detail relationships between custom objects
  7. You also can define master-detail relationships between a custom object and a standard object, but the standard object cannot be on the detail side of a relationship with a custom object. In addition, you cannot create a master-detail relationship in which the User or Lead objects are the master.
  8. You can display detail object record as custom related list on master object page layouts.
  9. You cannot create tab for a child object
  10. You can use master-detail relationships to model many-to-many relationships between any two objects. Maximum 2 master-detail relationship from a custom object.
  11. If the object is master of 1 or more detail object, you only can have 1 parent object for that object.
  12. If you have Roll-Up Summary field in parent and summarized with particular child object, when you create / update that child record, it will "edit" parent record, so if any validation rule triggered, it will stop to save when create / update child record.

No comments:

Post a Comment

Page-level ad