SharePoint 2010 brings in quite a few changes to Lists in SharePoint, especially in the lookup columns and enforcing relationships.
When you create a Lookup Column in SharePoint 2010 which fetches data from another List’s field, you can now add additional lookup fields and not just the identifier field!
Along with adding additional lookup fields, you can also enforce relationships so that it allows a cascade delete or restricts delete if a relationship still exists:
So, if there is a relationship associated, then you get this lovely error message when you try to delete an item (relationship behaviour configured to Restrict delete):
A Powerful Example to showcase List Relationships
Well, there isn’t much if I just show you the new options in lookup fields and relationships. Here is an example to show how powerful the relationships are in SharePoint 2010!
Projects and Employees List
So, I have two lists Projects and Employees list:
As you can see the Projects list has a lookup field Primary Contact which links to the Employees Fullname field. And the Employees list has a lookup field Project referring to the Project Title field.
If you click on a Project item, you get to see the project details, which is obvious:
Now, I would also like to see all the employees associated with this project. Given that we already have linked Projects and Employees list, this is certainly doable. You would go about asking any of your developers to build a web part that would do this job. With SharePoint 2010, its just plain simple with few steps 🙂
All we need to do is edit the default display form and add the Employees list!
In the SharePoint Ribbon (when you are on the List page, click on List in the Ribbon), select to edit the default display form:
This is the form that displays when you view an item.
This will open the default display form page in edit mode. Notice that the Ribbon now has Insert tab. Click on Insert and you will find the Related List button!
You can see the Employees list listed there! As it says, inserting this related lists web part will display related Employees items based on the Project lookup column! Go ahead and insert the list:
Below is the display form page with the related list web part added:
Save the page, and now, clicking on a Project item, you can see all the Employees associated with that particular project!
That wasn’t hard! Now, this is what I call a ‘killer-feature!’ 🙂