List Cascade and Restrict delete
SharePoint 2010 has introduced enforcing relationship behaviour on the list. We will see in this post what are the two behaviours that come up with the list
Consider the scenario that we have two custom lists; Category list and Product list.
Category list is the master(parent) list.Product(child) list has a lookup column which refers one column of Category list (say for example CategoryType column)
So, when we have data in Product list which refers Category list data; what behaviour the list should entertain is what that comes with enforcing relationship behaviour.
When trying to create a lookup column, following are the two options that come up in the RelationShip section.
If we select the radio button Restrict delete; that means that users cannot delete the data in Category list if the data is referenced.
They can only delete the data in the parent list only if the referenced data in the child list is completely deleted. So, if we want to delete an item in Category (ex:’Cat1′) we have to delete the Product list data that is using ‘Cat1’.
Sharepoint will give the following error if we try to delete until all references are deleted
If we select the radio button Cascade delete; that means that users can delete the data in Category list though the data is referenced.
But, once we delete the item in the Category list all the items that referred in the Product list will also be deleted.
While deleting it will give popup message which list is referencing its data and that data will also be deleted as in the following image
Cascade and Restrict delete is one of the cool feature on list which is very useful when we are managing common task of creating master and child relationships with lookup columns.