Tuesday, 5 September 2017

How To Stop Deletion Of Parent Record If Child Record Is Exist in salesforce Using Configuration

Arpit Sharma
In Salesforce if we want to create one to many relationship(one parent record have many child) then one way is to we can use lookup relationship feature of salesforce.

In case of lookup relationship If we want to stop deletion of parent record then we don't need to worry about it, We can configure it from look relationship configuration page.

We can configure it during lookup field creation and edit.

Salesforce provide us two option during lookup field configuration, we need to select second option to stop deletion of parent.

1. During parent record deletion set child lookup field value to blank.
2. During parent deletion stop deletion of parent.

But we can't select first option if we set lookup field to required on child object
because in that case we can't set field to blank because field is required on child record. You can see option in screenshot.



   
If we try to delete parent record then salesforce gives following error. 

Your attempt to delete Parent Record could not be completed because it is associated with the following Child Records. If the following table is empty, it is because you do not have access to the records restricting the delete.

So for deletion of parent record we need to delete all child record first.




About the Author

Arpit Sharma / Author & Editor

Certified Salesforce Developer | Salesforce Developer at Cognizant | Blogger

0 comments:

Post a comment