Google adds

Difference between master-detail relationships and lookup relationships

Difference between master-detail relationships and lookup relationships



Master-detail relationship

Lookup relationship

You can define master-detail relationships between custom objects or between a custom object and a standard object (standard object must be the parent).

You can define a relationship between any two objects, standard or custom.

When a record in a master object (parent) is deleted, all the records in the detail object (child) that are related to that master record will be deleted.

When a parent object is being deleted, you can configure a child object to either clear the parent record value in the child record or prevent deletion of the parent record.

All child records must have a related parent record.

The parent record may not require a related parent record.

The ownership of the child record is determined by the related parent record. Child records do not have an owner.

Each child record has an owner and is not related to the parent record.

The detail record inherits sharing and security from the master record.

There is no security or inheritance between related parent and child records.

To relate an object to another object, no records should exist in the child object.

To relate an object to other objects, there is no condition on the number of records.

If you have the Roll-Up Summary field in the parent object, any create, edit, or delete action in the child record will trigger an edit action in the parent object. If you have a validation rule and other rules in parent object, the validation rules will trigger for the parent object.

You cannot create the Roll-Up Summary field in the lookup relationship using out-of-the-box Salesforce functionality.

Supports cross-object workflow. You can configure a field update action to update a field in the parent record using a value from the child record.

Does not support cross-object workflow.



To create a master-detail relationship for an existing object with records as the child object, you can initially define it as a lookup relationship, populate all parent fields for all records, and then change the relationship to a master-detail relationship.



You can build a many-to-many object relationship using two master-detail relationships in a single custom object, which is known as a junction object in that case. 

No comments:

Post a Comment

All Governor Limit

Number of SOQL queries: 100 Number of query rows: 50,000 Number of SOSL queries: 20 Number of DML statements: 150 Number of DML rows: 10,...