Sharepoint SIG

Thoughts and ideas from your SharePoint support team

Parent-Child relationship between two lists in SharePoint – Part 1

| 0 comments

Written by Sheila ffolliott.  Moved from our old blog.

There is an easy way to create parent-child relationships between two lists in SharePoint without resorting to code or SharePoint Designer.  This allows, for example, the creation of an Order with multiple Order Items attached to it.  To do this, follow the steps below.

Note that both lists must exist in the same site.
1.    Create the parent list.  One of the automatically created fields will be “ID”; this contains a unique identifier for each item in the list.

2.    Create the child list.

3.    Go to the list settings of the child list.

4.    In the Columns section of the settings, click on Create Column.

5.    Create a column of type Lookup; set it to get information from the parent list and column ID.

6.    Go to parent list.

7.    Click on the List tab in the ribbon.

8.    In the Customize List section of the ribbon, click on the “Form Web Parts” drop-down and choose “Default Display Form”.

9.    Click on the Insert tab in the ribbon.

10.   Choose the child list from “Related List” drop-down.  A new Web Part for the child list will be inserted at the bottom of the screen.

11.   Click on the Page tab, then click Stop Editing to save changes.

Now the display form for the parent list has a new form on it that will allow you to add child records.   To add new records:

1.    Create an item in the parent list.

2.    Click on the new item to select it.

3.    Click “View Item” in the ribbon. The display form for the parent item will appear, with space at the bottom for the child items.

4.    Click “Add New Item” at the bottom of the form to add new child records.

Note that the ID of the parent item is not automatically filled in.  This is the subject of another blog post  “Automatically set the Parent ID field in a Child Record“.  Please read this post to find the details.

 
If you do not like the appearance of the default New Item form, it can be changed in SharePoint Designer.
 
Sheila ffolliott
Analyst, ITS

Leave a Reply