Showing All Versions of “Append Changes to Existing Text” in a Data View Web Part (DVWP)

While flying across the country to SPTechCon SFO 2011, I was going through some of my old “blog posts I should do sometime” lists and came across this cool trick. Brendan Horner (@hornerit) shared it with me months ago via Twitter and I socked it away for one of those extra moments. Well, I found that moment. It’s not something which hasn’t been written about before, but it’s something I’m asked about from time to time, and I never remember how to do it, so here you go.

imageYou’ve probably used the “Append Changes to Existing Text” trick in a list at least once. If not, here’s how it works. You have to have versioning turned on for the list for this to work. Then if you create a Multiple lines of text column, at the bottom of the settings you’ll see the option.

image

Setting the option to “Yes” lets you keep a sort of running log in that column. I’ve used it many times in tasks lists so that each person can add their $.02 during the process. Here’s what it might look like (with some silly test data):

One problem with this cool functionality is that in views, you don’t get to see the strings of text, just a link that takes you to the DispForm for the item. It’s a cumbersome UI choice, for sure.

So naturally, we’d like to be able to turn to a Data View Web Part (DVWP) to improve the user experience. To make this work, you need to add the following line into your XSL:

<SharePoint:AppendOnlyHistory FieldName="Comments" runat="server" ControlMode="Display" ItemId="{@ID}"/>

When you do this, you get a nice listing of the history, like this:

Much nicer! Thanks, Brendan.

Similar Posts

106 Comments

  1. Need to pass these all comments in work flow , Is it Possible.My requirements is to send a OOB WF mail along with all these comments

  2. Is this possible when using SharePoint 2013 if I use SharePoint 2010 Designer to edit (since Designer 2013 has no Design view)? I don’t see anywhere that I can edit the xsl template. I created a new list in Designer 2010 and a new site page to house it in. Added the DVWP but I don’t know if I just don’t see the same verbiage as others because I have a 2013 site vs a 2010 site or what.

  3. Hi Marc,

    I’ve created the DVWP but I can’t find the XLS file that you mention where I have to put the code. I’ve opened the page on SP Designer and added the DVWP there. What should I do now? Any help would be appreciated.

    Regards,

    Rafael

  4. I realize this thread is a few years old, I have a question though and am hoping someone is still following it. Is it possible to do this same thing in a content editer web part?
    Thanks

  5. Hi,

    Thanks for the solution. But I am able to apply this as a dataview webpart and custom List Form.
    But all I am seeing after applying is all versions in dataview. And with custom List, all versions when I click on view Entries. How do we see at the List level as per your screenshot?
    I want to export the latest version in excel. I am getting blank entries into excel..

    Thanks Againg for your solution.

      1. That was a very quick reply.Thanks.

        I inserted a dataview webpart,and replaced the code. I am seeing a dataview with just one Item’s versions.

        And I also figured out adding custom List and displaying in the all items form, all the versions.

        But when I got back to my list view and remove append or with append, the blank comments are still coming up in excel.

        How do I get all the versions shown in the List as per your screenshot.
        This has become a big problem since there are a lot of items with blank fields and users are facing problem with blank fields filled up in excel instead of previous filled in version of a single append only column.
        I hope I tried to write it clear.

        Thanks again.,

  6. Hi, i know this is an old post but still great trick. Is there anyway of limiting the history to a set number of comments? So for example it will only show the latest five comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.