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.
You’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.
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.
I know this is quite an old post, but I really need this functionality to work with my SP2016 website. Unfortunately I can’t find a DVWP here… And I can’t use SP Designer.
Is there a way to use this code with an XML Viewer Webpart or a Script Editor?
Thanks in advance!
@FlorianF:
You can call the REST endpoint to get the version history of the items. Example:
/_api/lists/getbytitle('Projects')/Items(1)/versions
M.
Thanks Marc.
I was quite lucky in the MS Technet Forums and already got a working solution
https://social.technet.microsoft.com/Forums/en-US/3c28ba4e-427e-476a-ada4-e5d7b7dc86b1/expand-multiline-text-with-active-append-feature-no-sp-designer-no-workflows?forum=sharepointdevelopment
Hi, Please im bigginer in Sharepoint. How i can access to the XSL to change that?
@Jihen:
I’ve got an entire series here about how Data View Web Parts (DVWPs) work. Check out Unlocking the Mysteries of Data View Web Part XSL Tags.
M.
Hi Marc,
Very smart solution this is, I want to display the same in AgilePoint workflow – capturing all technical updates for a ticket in multiline text on each update, these updates should go in mail which is triggering from AgilePoint workflow. Please let me know if you have any suggestions here.