Monday, August 24, 2015

Salesforce: Lookup Options in Lookup Relationship

When you create a lookup relationship from child to parent, there are a few option you can configure.

What to do if the lookup record is deleted?
1. Clear the value of this field
This would be the default option. Relationship between parent and child would be very loose. You can delete the parent or child without affected each other.

2. Don't allow deletion of the lookup record that's part of a lookup relationship
This option will not allow user to delete parent record when it have child records. But, deleting child record will have no issue.

Screenshot below show how the system will response upon deletion of parent with child record.
4 ke 1 is parent record ; 5 ke 1 is child record ; 5th level invoices is child object

There is also an option for Required - Always require a value in this field in order to save a record. By selecting this option, every child need to have a parent record upon record creation or update. This also mean, not allowing parent record deletion if it has child. Therefore, once this option is selected, only option (2) above Don't allow deletion of the lookup record that's part of a lookup relationship will be available.

If you have requirement to delete all child records once parent record is deleted, this is not covered in any of above scenarios using out of the box feature in Lookup relationship. One of the option is to change the relationship from Lookup to Master-Detail relationship.

No comments:

Post a Comment

Page-level ad