How to Show the Most Recent Comment on Items in a SharePoint Tasks List

When we left off last week, I’d reached a point in my test environment that matched the case that I was attempting to address: rather than having the most recent comment on an item in a tasks list render in the Comments column as desired, I was instead greeted with View Entries… hyperlink.  The time has now come for the exciting reveal of how to surface the actual comment.

Once I had reached the View Entries… stage, I took another run at Google in an attempt to find a solution to the problem, and what I discovered was not terribly encouraging in that while it looked like it would indeed be possible to surface the most recent comment exactly as desired, it sounded like it couldn’t be done out of the box.

So how can it be done?  Well, what I learned from a combination of the abovementioned Googling and a second consultation with Jeff Kozloff, there are actually two solutions available.  Option one, as discussed in a thread on the SharePoint Developer Center, involves using SharePoint Designer to create a Data View Web Part.  I still don’t have SharePoint Designer up and running, so that option isn’t really available for me to investigate (though I’m thinking that getting set up with SharePoint Designer should be on my list of SharePoint New Year’s Resolutions), but the second option, and the one that doesn’t involve any coding, is to go with a third-party Web Part.  And guess what?  As it happens, Bamboo’s own Data-Viewer Web Part fits the bill perfectly.

Bamboo’s Data-Viewer Web Part provides the ability to surface list data (as well as SQL Server, BDC /MashPoint, and/or List Rollup data), which is exactly what we need in order to show the most recent comments on tasks list items.  Best of all is the fact that with the Data-Viewer Web Part in place on your site, surfacing that list of data can be done in a jiffy.  I know this for a fact because I watched Jeff Kozloff do it in under two minutes using my own test list as an example.

Having seen Jeff do it, I went back and recreated the steps myself for purposes of documentation.  I first added the Bamboo Data-Viewer Web Part to a page in my test site, having selected it from the available Web Parts in my Web Part gallery.  The Web Part is, of course, created empty of content, save for the following instructional message which appears in the content area:  “No data source is configured for the Bamboo Data-Viewer Web Part. Please contact your Administrator to configure the appropriate data source in the Web Part tool pane.”

Hint:  Unless you’re trying to do something extremely complicated, you’re probably not going to need to bother your Admin, and you certainly shouldn’t have to do so in order to surface list data such as comments on a tasks list.  To wit: Once I surfaced the task pane by clicking the Modify Shared Web Part option under the Web Part’s edit drop-down, SharePoint List was already selected by default as the data source.   Selecting a list in the Master List area was my next step, which simply meant choosing my Task list comment test item from the drop-down (which automatically includes all existing lists on the site):

All that was left for me to do was to select the columns for inclusion in the Data Viewer Web Part, so I selected all columns (including, of course, Comments) on the left pane and clicked the right arrow button to copy them all to the right pane, thereby activating them for inclusion:

After clicking OK in the task pane, the Data-Viewer Web Part rendered and, as you can see in the right-most column below, the most recent comment (“comment two”) is now surfaced for the tasks list item which I created in my previous blog:

And that’s all there is to it.  Take a bow, Data-Viewer Web Part!

As a postscript, I should mention that in the course of my chats with Jeff, I also learned that Bamboo will be releasing Data-Viewer Web Part version 3.0 within the next couple of weeks, so all you Data-Viewer fans are going to have a cool new feature coming your way soon.

Read the entire Working with Tasks Lists series: