Site icon @WonderLaura

Filtering a Gantt View by Query String

This post applies to all versions of SharePoint and Office 365.

If you ever wanted to filter a datasheet view of a list or a Gantt view via parameter or web part connection, you may have noticed that there is no option to create this type of filter via web part connection, and these types of views cannot be tweaked in SharePoint Designer.

The method I’ve come up with entails creating folders for each of the type of thing that you want to filter by.  For example, if I have a case management site where I want to see a pretty Gantt chart of all of the task items only related to the progress of that one case, my folder structure of tasks needs to be one folder for each case in the case management system.

With that said, this solution may not be applicable in many situations where filters need to be done on-the-fly.

In my case management system, each time a new case is created, which is a single InfoPath form, I have a workflow that runs and creates several items in a task list, which are all of the tasks that need to happen for that case.  Every case gets the same set of tasks.  The workflow creates a folder in the task list, with the name of the case, then the workflow creates several tasks inside that new folder, for all that case’s tasks.

With that said, that’s the structure I’m dealing with.  Basically a task list with a folder for each case, and a need to have a dynamic “dashboard” for each case that shows only that case’s tasks as a Gantt chart.


  1. Go into the task list’s List Settings, and go to Advanced Settings. Change Allow management of content types to YES.

    Also while on that screen, set Make new folder command available to Yes. (For mine I didn’t have to do this, since I was creating the folders via workflow).  Click OK.
  2. Here is my task list.  See that it’s a list of folders.  Inside each folder are the tasks for that case.
  3. Create a new view in the task list.  After you click the Create View button, choose Gantt view.
  4. Name it whatever you’d like, such as something like “Gantt Tasks”.  Set this as the DEFAULT VIEW, and pick whatever Gantt view fields and settings you need.  It is very important that this is set as the default view.  In the Folders section, choose “In folders of content type” and choose Folder.  Click OK.
  5. On the task’s list settings screen, scroll down and click on the name of your view called “All Tasks” (the one that WAS the default view), and scroll down in the view’s settings to the FOLDERS section.  Under Show this view, select In the top-level folder.  (Note that this setting will NOT be in here if you haven’t done step 1 – allow mgmt of content types).  Click OK.
  6. On your List Settings screen, your views should look like this:
  7. You’ll notice now, that when you click Tasks in the breadcrumb trail to navigate back up to view your list, it will initially show just the names of the folders, but when you click on a folder name, then it will show the Gantt view of the items in that folder.  Now all you need to be able to do is link directly to that filtered list of items for each project’s “dashboard”.
  8. I need the URL, so I click on one of the top level folders and copy the URL.  A variable with the case name will have to be used in here, so that people can click a link to go straight to the dashboard for any project.  Here is the URL:
  9. See the 4443 in that URL?  THAT is the name of the case folder that I clicked on, so THAT is what needs to be variable per case.  Keep in mind that in this particular project, the original case was a form library of InfoPath forms that had been filled out for each case.  So what I want to do is add a hyperlink to my list of forms for “Details” for that case, which will take me to this filtered view of the tasks in a Gantt view.  Therefore, I’m going to my list of forms, and whatever the Case number is, that is what needs to be placed in that RED part of the URL.
  10. I opened up my list of forms in SharePoint designer, and simply added a new empty column to the table and inserted a hyperlink in it:/personal/laura/Lists/Tasks/gantt.aspx?RootFolder=%2Fpersonal%2Flaura%2FLists%2FTasks%2F{$thisNode/@FileLeafRef.Name}&FolderCTID=0x01200026FFDF69BB12F64096EF8BBB82B5EBA7
  11. The name of my InfoPath file name just happens to be equivalent to the name of my case, which is the same name I used for the name of all of the folders in the task list.
  12. Once you’re done adding that hyperlink, then save the page.  Now, when I’m looking at all my cases, I can click “details” to see the specific Gantt view of tasks related to that case.

Obviously, this is just a small piece of what is a much bigger project.  Hopefully you’ve enjoyed this tidbit.  If you’d like to read more about the concept of query strings in SharePoint, I’ve written a set of 4 blog posts that start here: Query String URLs are like, SO Useful! (Part 1 of 4)

Exit mobile version