Lookup relationship delete options
Key Takeaway
On an optional lookup field, the "What to do if the lookup record is deleted?" setting offers three options: clear the field (the default), block the deletion, or delete the child records too.
A lookup field links a child record to another record. When you create the field, you also decide what happens to the child records if a user deletes the record they point to. Unlike a master-detail relationship, a lookup lets you choose one of three outcomes.
The three delete options
When you create a lookup field, the setting "What to do if the lookup record is deleted?" controls what happens to the child records when a user deletes their lookup record. You choose one of these options:
| What it does | When to choose it | |
|---|---|---|
| "Clear the value of this field" (default) | Salesforce empties the lookup field on the child records. | The field doesn't have to contain a value from the lookup record. |
| "Don't allow deletion of the lookup record that's part of a lookup relationship" | Stops users from deleting the lookup record. | You have dependencies built on the lookup relationship, such as a workflow rule. |
| "Delete this record also" | Deletes the child records along with the lookup record. | The two records are tightly coupled, and you want to delete related data completely. |
For example, imagine an expense report with linked expense records. When you delete the expense report, you probably want its expense records deleted too, so "Delete this record also" is a good fit.
You get all three options only when the lookup field is optional. If you make the lookup field required, you can't choose "Clear the value of this field", because a required field can't be left empty.