The Force Platform supports two variations of parent-child relationships between objects: lookup relationships and master-detail relationships.
Both types of relationships work like foreign key relationships in a relational database, and produce some of the same effect on the pages for the objects in the relationship.
When you define the relationship between two objects, the Force Platform does a number of things:
Creates a field in the child object with an icon that allows users to look up valid values from the parent object. When a user views the child record in a detail page, the Record Name of the parent is shown for the field as a link that takes the user directly to the detail page for the parent record.
Creates a list of related child objects, which you can include as part of the page for the parent object
Creates a report type, described in more detail in Chapter 6: Reaping Value Through Reports, and that provides a way for users to make reports with data from both objects
You will see all of these features in action in your first hands-on example.
A lookup relationship generates all of the above features. A master-detail relationship adds some functionality and restrictions to these common features:
When a user deletes the master record in a master-detail relationship, all associated detail records are also deleted
The child records always have the same security specification and owner as their parent record in a master-detail relationship; in fact, the Owner field of the child record is not available
All child records in a master-detail relationship must have a parent record specified
The relationship field is required on the page layout of the child
You can use Roll-up Summary Fields with master-detail relationships, a field type used to store values aggregated from the child records in the relationship. This option is discussed later in this chapter in the section Roll-up Summary Fields.
A Force Platform object cannot be the master in one relationship and the detail in another relationship. An object can be the master in more than one relationship, but Force Platform relationships cannot be used to implement multiple levels of detail.
Tip
As with so much of the Force Platform, the easiest way to understand relationships is to simply create some to see how they work.
3.144.38.92