SharePoint List Parent/Child Relationship – E.g. Creating List B items from List A

Posted By Posted by: James Park on January 16, 2012

SharePoint List Parent/Child Relationship – E.g. Creating List B items from List A

Problem

The best solution to be able to efficiently create 1 or more linked child list items from a parent list.

Solution 1

The blog below outlines how to achieve the above using workflows – (See link below).

http://ppm.griff-in.net/2011/10/creating-actions-from-issues-and-risks.html

E.g. A user will create an “Issue” item and use a workflow to create each linked “Action” items.

  • Workflows can be set to auto run and create Action” items after creating an Issue item.
  • Still requires a few clicks to create an “Action” item.

Solution 2

The blog below uses SharePoint Designer to essentially add a web part to show a custom list in the List Forms for another custom list (DispForm.aspx, EditForm.aspx, NewForm.aspx)

http://geekswithblogs.net/SoYouKnow/archive/2010/12/16/creating-a-sharepoint-parentchild-list-relationshipndash-sharepoint-2010-edition.aspx

E.g. A user can create and view linked “Action” items when viewing or editing an “Issue” item.

  • A user can view and create “Action” items straight from an “Issue” items form
  • Although the Issue ID textbox in the New actions form is pre-filled, a user can potentially change the Issue ID that does not exist which will create an error.
  • Unable to create an “Action” item when create a new “Issue” item.

Referencing the above two solutions, here is the solution to create child list items from within a parent list.

E.g. Creating Action Items from Issue list.


Create the Parent-Child Custom Lists

  • Create the parent custom list “Issues” and create the necessary columns. E.g. Description, Status

  • Create the child custom list “Actions” and create the necessary columns. E.g. Description

Create the Parent-Child Relationship

  • Create the “Issue” column of field type “Lookup” that links the “Action” list to the “Issues” custom list using the ID.
  • Check the tickbox “Enforce relationship behaviour”

Update the List Forms for Child List

  • Go to the List > Edit List to edit the list using SharePoint Designer and select the DispForm.aspx in the forms panel
  • Delete the existing WebPartPage.
  • In the Insert ribbon click SharePoint > Custom List Form…
  • Select the options as shown in screenshot.

  • Go to List > Edit List to edit the list using SharePoint Designer and select the EditForm.aspx in the forms panel
  • Delete the existing WebPartPage.
  • In the Insert ribbon click SharePoint > Custom List Form…
  • Select the options as shown in screenshot.

  • Go to the List > Edit List to edit the list using SharePoint Designer and select the NewForm.aspx in the forms panel
  • Delete the existing WebPartPage.
  • In the Insert ribbon click SharePoint > Custom List Form…
  • Select the options as shown in screenshot.

  • Select custom list form in DispForm.aspx  and go to “Options” ribbon.
  • Add a new query string parameter by clicking “Parameters” and setting the options as screenshot.

  • Update the Issues field to reference the new parameter created – “ThisIssueID”

  • Select custom list form in EditForm.aspx  and go to “Options” ribbon.
  • Add a new query string parameter by clicking “Parameters” and setting the options as screenshot.

  • Update the “Issues” field to reference the new parameter created – “ThisIssueID”

  • Select custom list form in NewForm.aspx  and go to “Options” ribbon.
  • Add a new query string parameter by clicking “Parameters” and setting the options as screenshot.

  • Change the Format for “Issues” field to TextBox
  • Update the “Issues” field to reference the new parameter created – “ThisIssueID”

Update the List Forms for Parent List

  • Go to List >Edit List to edit the list using SharePoint Designer and select the DispForm.aspx in the forms panel
  • Insert a related item view below the list form by going to Insert > Related Item View > Action Issues

  • Go to List > Form Web Parts > Default Display Form
  • Add a content editor web part to input a link and javascript function as shown in screenshot

  • Go to List > Edit List to edit the list using SharePoint Designer and select the EditForm.aspx in the forms panel
  • Insert a related item view below the list form by going to Insert > Related Item View > Action Issues

  • Go to List > Form Web Parts > Default Edit Form
  • Add a content editor web part to input a link and javascript function as shown in screenshot

Display Form for Parent List

 


Edit Form for Parent List

 

 


Blog Posted In Blog Posted In: How to, SharePoint
Blog Posted In 

Leave a Reply

Your email address will not be published. Required fields are marked *