in SharePoint 2010

SharePoint 2010 Lists Improvements – List Lookups and Relationships

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!

image 

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:

image

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):

image

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:

image

image

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:

image

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:

image

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!

image

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:

image

Save the page, and now, clicking on a Project item, you can see all the Employees associated with that particular project!

image

That wasn’t hard! Now, this is what I call a ‘killer-feature!’ 🙂

Write a Comment

Comment

Time limit is exhausted. Please reload the CAPTCHA.

  1. I hope this control allows fields to be selected from the target list that are part of a BDC field.

    As an example, if your employess list above had a BDC column that also fetched the access card number or some other value, and you then want to be able to select that as an additional field.

  2. Chaks’ cool article.

    Quick question.
    Have you been able to get any additional field which aren’t text fields? I am tring to get Person or even a lookup from a related list.

  3. Thanks for this.

    Anyone have any thoughts on how to add a related/child record that will automatically be associated with the parent record?

    Cheers,

    :|Ben

  4. Hi,

    Excelent! I am now able to see parent child relationship. Now what I want to achieve is;

    1. I have created a parent list. Done
    2. Child list is also created pointing to parent list using lookup column. Done
    3. Now what I want is that once an entry in parent is created, then I should be able to create an entry into child list.

    I am trying my best but your above blog helps me only to view (in Display Form) but not in New Form. Please help.

    Thanks!