Salesforce Tip: What to do if the lookup record is deleted?

When creating a lookup type field, there is a setting called ‘What to do if the lookup record is deleted?‘. There are two options under this setting. It is very important to understand the behaviour and outcome of these options and apply them accordingly based on your preference.

 

  • Clear the value of this field. You can’t choose this option if you make this field required.
    • If the lookup record is deleted, then the lookup field value will automatically become empty.

 

  • Don’t allow deletion of the lookup records that’s part of a lookup relationship.
    • Lookup record can’t be deleted as long as it is being lookup by other records.
    • When you try to delete the lookup record, you will receive a warning message stating the record can’t be deleted and the list of records that are associated with.
      For example: