Get rid of ‘View Entries’ in a SharePoint 2013 Append-Only Column in a View

July 25, 2014 by
Donal McCarthy

It’s unlikely that the word ‘collaboration‘ would be missing from any high-level description of SharePoint. Collaboration is supposed to be one of the main benefits of SharePoint and it is; however, sometimes SharePoint makes it harder to collaborate than it really should be.

 

Book a personal demo to speak with a BrightWork Solution Consultant about your specific PPM requirements 

 

Take a ‘Multiple lines of text’ column with Append Changes enabled – this is a great feature as it allows you to have a conversation right in a list item. Who said what, when they said it and what they said is captured for all to see – just like in a forum (if you are not familiar with this feature, don’t worry – I will explain how to enable it in the steps below).

In this post I will describe how to get these comments and the associated metadata to appear in a ‘view’ – you will need SharePoint Designer 2013 for this. I will be applying the changes to our free SharePoint project management templates, but you should be able to follow the steps in your own SharePoint site or in the full BrightWork product (click the link to take a free trial).

The crux of the problem I am addressing today is that when you add an Append Only column to a view, you can’t see any of the entries, instead what you see is a “View Entries…” link that opens the item – not great if you just want to scan the list for recent comments.

view-entries

Wouldn’t it be great if you could see the comment history for multiple items simultaneously – just like in the image below? You can do this with the Data View Webpart and SharePoint Designer  – read on to find out how. Hat-tip to Marc D Anderson for setting me on the way to solving this.

comments-in-view-1024x3061

Add Append Only Column

Just in case you are unfamiliar with the Append Only Column, see below for how to enable it. If you already have such a column in your list, you can skip ahead to the next section.

  1. Go the the List Settings page and click Versioning settings.
  2. Select Yes to enable versioning for the list and click OK.
    versioning
  3. Add a Multiple lines of text column to your list and select Yes beside Append Changes to Existing Text.
    versioning2

Tip: Unselect Add to default view as you will just get the not very usable View Entries bit you can see in the image above.

Enable Comments in Data View Web Part

In this section will describe how to get the comments into a view.

The Data View web part is one of those hidden SharePoint gems that not many people know about, mainly because you really need SharePoint Designer to get the most out of it. With Design View gone in SharePoint 2013, it gets a little (maybe a lot) harder to work with, but you can still do most of what you used to be able to do.

  1. Create a new page in the Site Contents library (any web part or wiki page will do).
  2. Open the page in SharePoint Designer.
  3. Click Advanced Mode to enable code editing.
    advanced
  4. Click between the two Zone Template tags.
    zone-template
  5. Click Insert | Data View | Empty Data View.
    (Selecting a specific list inserts a List View web part, which we can’t use here)
    empty-data-source
  6. Click between the Data Sources tags.
    data-sources-code
  7. Click Insert | Data Source | Project Tasks.
    data-source
  8. Select the Task Name column in the Data Source Details panel and click Multiple Items View on the Insert Selected Fields as menu.
    data-source-details
  9. Click Add/Remove Columns.
    add-remove-columns
  10. Add the columns you want to add and click OK.
    add-columns-to-data-view2
  11. Click F12 on your keyboard and Yes twice to view the page in your browser – you will notice that View Entries displays!
  12. Return to SharePoint Designer and find the XSL that relates to the Comments column – it is high-lighted in yellow below. An easy way to find it is to search for “td class=”ms-vb”.
    xsl
  13. Replace the XSL (the bit high-lighted in Yellow with the below code and make sure that the field name matches what was displayed after the @ sign in the XSL (‘Comment’ in this case).
    <SharePoint:AppendOnlyHistory FieldName="Comment" runat="server" ControlMode="Display" ItemId="{@ID}"/>
  14. Click Save and when you refresh the page you should see all the comments in the data view!
     comments-in-view-1024x3061

     

Update 1 – Fix AssignedTo Issue

Thanks to Jordon in the comments for setting me on the right path to this.

Essentially, you must replace the XSL for Assigned to with the below code.

<SharePoint:FieldValue FieldName=”AssignedTo” runat=”server” ControlMode=”Display” ItemId=”{@ID}” />

assigned-to-fix1

assigned-to-fix2

Limitations

Unfortunately, we don’t get all the options we normally get in a standard view. Really all I was able to get was the ability to see all Comments in all items in a list. When I added the Assigned To column, I got a weird error where a lot of code was also displayed (see image below).

What I would really like to be able to do is show the comments in a standard view, with the list item menu and so on, and be able to opt to only show the last comment or the last two comments.

So if you know how to rectify these issues or anything else, please add a comment.

assigned-to-error

SharePoint Project Management Template

Share
Share
Tweet
Pin