AgileApps Support Wiki Pre Release

Master-Detail relationship

From AgileApps Support Wiki
Revision as of 20:14, 30 July 2014 by imported>Aeric (→‎About Master-Detail Relationships)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A Master-Detail relationship is a one-to-many association between two objects, where detail records only exist when there is a master record to point to.

Examples of Master-Detail relationships include:

  • 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 a more detailed example, consider an order management system, where the Master object is Orders and the Detail object is Order Items. Together, an invoice can be prepared from those records. Each line in the invoice can display the number of items ordered, the unit price, and the line item total, using values taken from the detail records. Sales tax and sub-totals, meanwhile, can be calculated and stored in the master (invoice) record.

In addition, when an order is deleted in a system like that, then all associated line items should be deleted as well.

In the AgileApps Cloud platform:

  • Rollup Summary Fields are used to do calculate the line item totals.
  • Cascade Rules are used to auto-delete detail records when a master record is deleted.
  • Subforms are typically used to view and modify detail records while entering or editing a master record.

Notepad.png

Note: There used to be an option to specify "Master-Detail relationship" when creating a Lookup field. That option became redundant, however, and has been removed. Rollup Summary Fields and Cascade Rules achieve the same goals, but they work across multiple related objects--not just those that have a particular flag set on the Lookup field that connects them.