Master-Detail relationship
About Master-Detail Relationships
A Master-Detail relationship is an association between two objects. When a Master-Detail relationship is created, it implies a tight relationship between the two objects. In essence, a Master-Detail relationship locks the objects together, so that every record in a Detail Object is associated with a record in a Master Object.
Master-Detail relationships can be used in scenarios like these:
- Invoices, where items in an order are detail records, and pricing or discounts are fields in the master record (the invoice)
- Timesheets, where employees are master records, and hours worked are detail records
- Inventory, where where shoe style is a master record, while detail records specify the size and color of shoes in stock.
For example, in an order management system, the Master object is Orders and the Detail object is Order Items.
Together, an invoice can be prepared from the order items. Each line can display the number of items ordered, the unit price, and line item total. Sales tax and sub-totals can be calculated and included in the invoice.
If an order is deleted, then all associated line items are deleted as well.
Note: The option to specify "Master-Detail relationship" when creating a Lookup field became redundant, and has been removed. Now, Rollup Summary Fields are used for summary calculations on fields in detail records, and Cascade Rules can be used automatically delete detail records when a master record is deleted. Those operations work across multiple related objects--not just those that have a particular flag set on the Lookup field that connects them.)