SharePoint Related Lists (Part 4 of 4)

Yes, the title of this post is a little confusing, especially if you read the other 3 parts, but let me explain.  The first three parts of this series were all about the Query String URL Filter, and how to create mashups that display multiple related lists on one page.  Lists have a lot more relational capabilities now, which is seen everywhere from lookup columns to workflows.  So, since we’re talking about mashups and related lists, I thought I’d show you the Related Lists button in SharePoint 2010/2013, which lets you quickly throw a few web parts on a page, and automatically connects them.  So, another title for this blog could be “how to do the stuff from the other 3 posts… in SharePoint”

In this example in SharePoint 2010, there is a main projects list with several lists with related items that lookup to the projects list.  Let’s create some simple ones quickly, just to try it out.

  1. Custom list on the site called Projects.  To try it out, all you need is a Title field.
  2. Create a new Issues list on the site.  Create a new required lookup column in the list, called ProjectID, and make it look up to the Project’s Title field.
  3. Create a new Project Tasks list, and also add a required ProjectID field that looks up to the Project list’s Title field.
  4. Create a few items in each list, with some tasks and some issues associated with each project name.
  5. Go back to the Projects list.  Click to create a new view, name it Mashup.
  6. On the new view, click Site Actions and choose Edit Page.
    CHECK IT OUT!!!  There’s a button in here to Insert Related List!!!image
  7. Click the Insert Related List button, and the drop-down will show the Project Tasks list and the Issues list.  Insert each one on the page.
  8. On the Page tab in the ribbon, click Stop Editing.  This is what the page looks like now:
    Click to zoom in

DONE.  WOW, it’s going to be so easy now for end users to be able to create their own related list views, without even having to know how to create the web part connections!

How did it work?  Since the Issues and Project Task lists contained Lookup columns to the Project list, SharePoint automatically knew to consider them “related lists”.  If a list has no other lists that look up TO IT, then the related lists button will be grayed out.

One more thing… yes, the Related Lists button does exist in SharePoint Designer 2010 also, and not just in the browser.

Here are the previous parts in this series:

Advertisements

46 comments

  • I can follow your instructions concerning related lists in the browser, however I can’t get it to work in SharePoint Designer. Can you tell me how to do it?

    Like

  • Jane, The Related Item View button is on the Insert tab in the ribbon in SharePoint Designer 2010.

    Like

  • Yes, but I can’t get it to work. Any ideas?

    Like

  • Thanks Laura Your tip helped me a lot!

    Like

  • For Insert Related List when we add a new Item in child List,The Item selected for parent list is not defaulted in the lookup combo any idea?

    Like

  • Has anyone been able to solve the issue with the Add New Item action not defaulting to the parent item? This is a major pain from a usability perspective?

    Like

  • Simon, Yes, there’s a way to do that. When I get a chance, I’ll blog about it.

    Like

  • Any news on the defaulting to the parent item issue that Simon brought up? Thanks.

    Like

  • Laura, Looking forward to your solution To Simon’s question . . .

    Like

  • Same here – the answer to the parent item question would be super useful.. I’ve gotten half the answer here – http://www.endusersharepoint.com/2009/11/03/setting-sharepoint-form-fields-using-query-string-variables-without-using-javascript/ But it’s missing the piece that actually passes the parameter to the new item form…

    Like

  • This will take care of adding a child item with the parent lookup pre-filled. To make it work: 1. Add a Related List to a Display or Edit form on the parent list 2. Change the ExampleLookup value below to the title of the lookup field on the child list that refers to the parent list When the user clicks Add New Item on the related list on the parent list, the child list’s new item form will appear with the lookup field pre-populated with the parent value. function getQuerystring(key) { key = key.replace(/[\[]/,”\\\[“).replace(/[\]]/,”\\\]”); var regex = new RegExp(“[\\?&]”+key+”=([^&#]*)”); var qs = regex.exec(document.referrer); if(qs == null) return default_; else return qs[1]; } http://www.google.com/jsapi // You may specify partial version numbers, such as “1” or “1.3”, // with the same result. Doing so will automatically load the // latest version matching that partial revision pattern // (e.g. 1.3 would load 1.3.2 today and 1 would load 1.4.4). google.load(“jquery”, “1.4.4”); google.setOnLoadCallback(function() { $(“select[title=ExampleLookup]”).val(getQuerystring(“ID”)); });

    Like

  • Tylerstjohn@gmail.com

    In reference to corey’s function, why doesnt this work on a lookup column?

    Like

  • Corey Martin (coreym@gmail.com)

    I’ve cleaned up the function above and tested it (thanks for your help with the testing, Tyler). It is now packaged up into .JS files and will take care of pre-filling a lookup column with the parent item ID: http://code.google.com/p/sp2010-related-list-prefill/ Corey

    Like

  • Here you go guys, I blogged about how to do this in a data view web part, no code: http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=107

    Like

  • Tylerstjohn@gmail.com

    Thanks Laura — but since my company blocks SPS; JQuery is my best friend!

    Like

  • Hi Laura, Great blog to get our attention and into this functionality. Intersting in that when I create the webpart with the linked list, it works, but a Site Collect error is introduced on all pages. I believe this to be a Sharepoint issue, but though I run it by you. That is, before the related list webpart, all pages on the site rendered without errors. After implementing the technique mention, I found these errors on all pages evev after I delete that page with the web part and the two lists. I am still research to understand what is happening. Any insight is appreciated. Bob – bob.skowron@infor.com) +++++++ Message: Syntax error Line: 2 Char: 1 Code: 0 URI: http://edison/ScriptResource.axd?d=xbacvS0rahJ6JOIeoMlGzo_HMBcluTGUtIEg_HcP8VLJTFREkJuUirLD8JQDaW0yFHSCZF8WoqJBrw40E7wUhTcQ6o-tBASzOT9gjuM_IYqBHpy5I_vNyAsZ9gXH7U0kGl8lOgMRt6Qazl5RYVkgolTFtUY1&t=fffffffff9d85fa6 Message: Syntax error Line: 2 Char: 1 Code: 0 URI: http://edison/ScriptResource.axd?d=wSjmDuPomb6xsEaMkglAV9I8hlDcbourHB6aAuapOCmnGyvpPgqKeH7TQGqroGa2wyNa33c2_KRRhcEqFkiwp7JvPbG31kMBtFv5W9x9M6OeHAdoB6n-UxDNA8Z18KkrQJxLbbexWcE1ZG2i17EO1wJsDIEVN9oPyT7oU2wdFe09RSHi0&t=fffffffff9d85fa6 Message: ‘Type’ is undefined Line: 2 Char: 1 Code: 0 URI: http://edison/_layouts/sp.core.js?rev=7ByNlH%2BvcgRJg%2BRCctdC0w%3D%3D Message: Object doesn’t support this property or method Line: 2 Char: 132 Code: 0

    Like

  • Bob, I don’t know, I’ve never seen that happen. Have you got a customer master page or custom page layout or something? That could be a factor.

    Like

  • Thanks a lot Laura, This is what I was looking for… YOU ROCK !!!

    Like

  • Laura, I started to love you. You have great video tutorials and all the articles are a must read to get these needed features work. I’m out for your blog … and especially for your next video 😉 Your admirer, David Valicek

    Like

  • Laura, Great Tip! I have noticed one issue that seems to be a problem though, and it looks like it was exhibited in your demo of this as well. When you add this view, once you add the related list to the view, it removes your “page” and “List” options to access the ribbon bar, and without the ribbon bar it appears you can not change to other views for the list. This could be a major inconvenience if you want this to be the default view. Have you found a way to get around this?

    Like

  • Hi Laura- After adding a related item view, I want to edit the web part to change which columns appear. But if I edit the current view of the related item view web part, the relation to my parent list seems to break as the items in the related view no longer show up. The related view web part connections still says it’s getting data from my parent list. Do you know why this happens and how I can modify the web part without breaking the relationship?

    Like

  • Oscar, Yes, it’s a known bug. You can go to list settings, and scroll down to the Views section. Click the name of your view there, so that you are able to edit the settings. TW, All I can think of is to try modifying the connections by opening the page in SharePoint Designer, and see if you get better results. That would be my next troubleshooting step.

    Like

  • Hi Great posts – I knew you should be able to create a simple parent/child page without resorting to code, but was struggling till I found your blog. I created a web part page as described, and then modified the Add Item link on the xslt List View to add the ParentID as a parameter so that when you click add item you get the parent id set Keep Blogging James

    Like

  • Hi Laura… I am using this in a Email Archive Library….. which has multi level folder structures…… If I relate the Library to Tasks, Appointments etc. using a Lookup field say the Title of the Email Archive Library……….. the first level is working fine….. but when I click an item in the Email Archive Library and the next level does not appear…. Error – One or more field types are not installed properly. Go to the list settings page to delete these fields. Correlation ID:8a2ec7a3-9497-40f6-b815-3bece4883364

    Like

  • Thendral, That sounds a bit obscure, so I can’t tell off the top of my head what the problem is. You can use that correlation ID to look in the server’s logs, though.

    Like

  • At the end of the post, you have this:

    Query String URLs are like, SO Useful! (Part 1 of 4)
    Query String URLs are Magical (Part 2 of 4)
    The Query String URL & Data View Web Parts (Part 3 of 4)

    But the links all go to other unrelated articles.

    Like

  • Hi Laura, similar topic to the above but not quite, do you have any idea why the path command in 2010 no longer functions in the same way as it used to in 2007?
    I had a list that generated items in other lists via workflows, these items were automatically connected through the path column which gave a link between the two. This was working great, however path no longer seems to work correctly, instead giving me 3 options, none of which do what it used to so I cannot simply copy my workflows across..
    Is a variation of the above the likely answer or is there an alternative to the path column do you know?

    Like

  • Hi Laura – Love all of your Topics!!!

    Question: How can the Child items know there was a change to the Parent item and therefore update, fire off a workflow, for each of the children?

    Is there a way to look up all the Children and then take action on each Child?

    My primary list (P) has a Title made up of 4 different columns….. My Related List (R) uses P.Title as the “Parent_Record” column (lookup) and concats the R.Status to make a final R.Title…. Sorry for the confusion …

    If/when an update is made to any of the P.list 4 columns making up P.Title, the onchange workflow remakes the P.Title…

    The R.Parent_Record sees the update … but … The R.list does not see it as a “change” and will not fire the onchange workflow in the Related List to remake R.Title

    Like

  • Jeff,
    In cases where I needed to do that, I purchased a product called Virto workflow activities. It lets you loop through items and make changes like that, where SPD workflows do not have that capability. SharePoint 2013 workflows DO have this capability, though.

    Wayne,
    Sorry I don’t know what you’re referring to.

    Like

  • Thank you for the response and the info Laura!

    Very much appreciated … Can’t wait for the company to get to SP2013.

    Like

  • Hi Laura, apologies.
    I’ve re-read my question and I am not suprised you couldn’t work out what I was asking.

    Basically I have 2 lists with workflows whereby list A creates the items in List B and, using a lookup and the hidden/system path column, displays a link between the two..
    These workflows have now broken in 2010 as the path column no longer works in the same way.
    I am thinking now I can maybe create linked lists from other lists using a mixture of the related lists example you kindly suplied us above, and the create list option in the workflows.
    As long as I bring the titles from one to the other and relate on that, I guess that should work in theory?

    Like

  • Laura
    You’ve probably been asked this before, but what’s the easiest way to change the select (link) icon (double arrow) on the link list
    thanks

    Like

  • Wayne,
    Is the other list a task list. Try reading my post called “workflow – how to set task fields”.

    Cmhaynes,
    No, and sorry I don’t know how to do that. I’m guessing maybe create it as a DVWP instead and when you create the connection, it asks you to create a hyperlink. Then, maybe you could go into the code and make that a clickable image instead of a text hyperlink.

    Like

  • Hello Great blog
    I would like use folders in my main proyect list. That works but there is not folder icon and after creating a new folder i can’t see if the new row is a new item or if the new row is a new folder. Do you know a way to prevent users to create a related item to a folder.
    thanks

    Like

  • Miguel,
    Sorry I’ve never tried this solution with folders involved. One thing you can do is in your view settings, expand the “folders” section, and select “show content without folders”.

    Like

  • Laura,
    This is a wonderful blog, I spend hours today trying to figure it out – and your blog had me creating my page, adding the web parts, and filtering them in minutes. THANKS! Is there anyway to pass multiple values in the query string URL to the page. That is the only thing I couldn’t get to work.

    thanks again ~ang

    Like

  • Hi Laura… thanks a ton for this.

    Like

  • Grouping List by Multi-Choice Columns

    I found out the hard way that SharePoint doesn’t support sorting or grouping lists by Choice columns that are set to “Allow Multiple Values.” do you know of a way to do this.

    Sorry if this is in the wrong place:

    Like

  • AngieA,
    If you’re using the query string filter web part, there’s a setting for multiple values, and your URL would have to have
    ?Field1=xyz&field1=abc
    like that.

    Grouping list by multi-choice,
    I’ve found that if you put a choice filter web part on a page, and create a web part connection to your list, it will let you at least filter by one value at a time.

    Like

  • We have this setup perfectly as in your instructions. However, when we add Key Filters on the quick launch (Managed Metadata Navigation) the web part errors out. As seen below.

    Unable to display this Web Part. To troubleshoot the problem, | open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.

    Correlation ID:c08ca49c-d66f-b02e-9d35-dca3a03d7967

    In the ULS logs I get the following:

    Error while executing web part: System.ArgumentNullException: Value cannot be null. Parameter name: parameter at System.Xml.Xsl.XsltArgumentList.AddParam(String name, String namespaceUri, Object parameter)

    Failed to get document content data. System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function

    Could not get DocumentContent row: 0x80004005.

    Otherwise, works great.

    Like

  • Hi mallen,
    That sounds like a mess, and is obviously a bug in SharePoint 2010. I did just test this in 2013, and the bug no longer exists. I do recommend trying this on a different/new set of lists and see if it happens on all of them, so you’ll know if maybe there’s just something weird about one of those lists/libraries you’re using.

    Like

  • Thanks Laura. We found that switching the web part’s view from Current to Summarized also corrected the issue.

    Like

  • Thanks for the tip!

    Like

  • Hi Laura, it’s possible to do in a Image Library?

    Like

  • Does related lists supported in SharePoint online ?

    Like

  • Dear Laura,

    I try to build a more complex related list with 3 levels and there is a strange behaviour. I explain : I have a first costum list with summary definition. then I link on the page this custom list with another custom list (which contains detail of the first custom list). At final stage each item of the first custom list is related to one or more items of the second custom list. But on a intermediate stage, perhaps one or more items of the first custom list are not linked to item(s) of the second custom list.
    This works fine.
    But when I link on the same page another custom list to the second custom list, I have a problem. If I select a item on the first custom list which is not linked to an item of the second custom list, the third list is not refreshed. Do you have any idea ? Thank you beforehand for your suggestion or help.

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s