Monday, April 1, 2013

Linking Lists & Editing The Default Display Form

This post will explain how to create a connection between two lists and then how to display the connection in the display item form. These lists are extremely simplistic, but they will help to visualize the idea. (I apologize for the small screenshots; Blogger does not seem to like my Snagit Shots)

Creating a connection between two or more lists can be extremely helpful and for this example I will explain it in terms of Employees and an Employer. If any of you have had to work with database schemas in the past, you will know all too well about data relationships, data integrity rules, and normalization. For those readers who have not had exposure to this yet, here are the cliff notes.

There can be many employees to one employer, so the relationship is a one to many relationship. For the linking of these lists we will want the Employer (Parent) to display all of the Employees (children) when we open the "View Item Form."

To do this we will create two custom lists (the meta data within each list does not matter for this example, but you will need the lookup field)

1.      Employer

a.       Employer Name –title

b.      Employer City – combo box

c.       Phone Number – single line of text


2.      Employee

a.       Employee Name - title

b.      Employed By - lookup

c.       Employee Type – radio button

d.      Emergency Contact Number – single line of text

The field which will enable this connection of the two lists is the lookup field

Within the Employees List (Child) select the Lookup field and select Employer (Parent) like I have done in the below screenshot.


Now that you have created the two lists, create some dummy data within Employer & Employees so there is data to select from.

I have created three list items in “Employee” linked to “Employed by" Example 1

This view is ok when viewing the data from the Employee list, but what about the view for the “Employer List?”

This view does not show us any of the employees that are linked to example 1, so we will edit the display form to show our related items.

List Tools → List→ Customize List→ Form Web Parts→ Default Display Form


From this page go to:

Page Tools→ Insert→ Related List→ Employee

Your View Item Form should now resemble the following


Congrats on creating a connection and displaying it in the “View Item Form!”


No comments:

Post a Comment