Click on the Next button at the bottom of the page to jump to the next step. Note that the Field-Level Security (FLS) for the new object’s field defaults to Visible/Writable, and that the master–detail lookup is a required field by default (after all, you cannot have a child without a master record):
Master-detail field has a fixed FLS configuration
Click on Next to select the proper object page layout where the new field must be placed. Even now, the Case Detail page layout is mandatorily selected, as the field is required:
Master-detail field page layout selection
Click on Next again and select the Master object (Case) page layout in which the new Case Details- related list should be placed (this last step is only available for relationship field types):
Master–detail related list inclusion on the parent object’s layouts
Because we put in place a filter on the relationship that matches only support cases, selecting only the Case (Support) Layout makes perfect sense.
Create a master–detail relationship only when the object has no records at all (otherwise, Salesforce doesn’t know which are the parents of the record already on the dataset). You can create a lookup field instead, populate it for all your current objects, and then convert the field into a master–detail relationship.
To test the relationship filters, let’s create a new Custom Object tab from Setup | User Interface | Tabs | New in the Custom Object Tabs section and add it to the Service (standard__service) app:
Case Details custom tab
Now, exit the setup and jump to the Service app, which looks as follows:
Case Details tab in action
Click on the New button and create a new record. The only available field is the Case master–detail relationship. Select + New Case and create a new record with the unexpected record type (Sales Request):
Case creation within a case detail record
Click on Save to save the case. The new record should now be related to the case detail record we are trying to create. Hit the Save button on the New Case Detail wizard to trigger the following error message:
Master–detail filter in action
If we select a Support Request record type in the previous step, then the case detail is saved as expected.
This is what you get in the lookup window in Classic mode (have a look at the initial Select a support request case message):
Master–detail lookup window selection in Salesforce Classic
What’s peculiar about master–detail relationships? The thing to note is that by deleting the master record, we are deleting its children as well (and when we undelete them—that is, restoring them from the bin—it will automatically undelete the children as well). However, if you delete one of the children first, and then delete the master record and then undelete it, the first deleted child will not be undeleted.
A child record inherits the master record’s owner; that’s why sharing rules and manual sharing is not available on child records. For the same reason, children inherit their master record’s access level.
A custom object can have up to 2 master–detail relationships, up to 40 total relationship fields, and up to 5 active lookup filters (go to Setup | Object Manager | Custom Object | Object Limits for a full list). You can have a maximum of three master–detail levels and, within this hierarchy, the records cannot be referenced more than once. If it is a detail record on a given multilevel relationship, then it cannot be the master of another multilevel relationship.
For data skew limits, remember not to parent more than 10,000 child records to a master record.