Cross posting this from Reddit, since it's not getting a lot of love there.
One of the biggest challenges I have with getting users to buy in to SharePoint's versioning features is the fact that version history is kind of a PIA (from a user experience perspective) to get to. Adding to that, if you use an append only comments field, and you happen to have an item (say, a project tracking line item) that takes a lot of updates over time, the form can get unwieldy and stupid to deal with. I get a ton of complaints about that.
So, I had the brilliant idea to use a little javascript/jquery magic to go GET the version history page for an item and remake it into something that could be viewable on the edit/view item form. Here's my code (don't laugh at me, I literally taught myself javascript last year on the job):
function getVersionHistory(guid,id){
var d=$.Deferred()
var versionsUrl=url+'/_layouts/versions.aspx?list='+guid+'&ID='+id;
$.get(versionsUrl,function(data){
var versionEntries=parseVersionList(data);
d.resolve(versionEntries)
});
return d.promise();
}
function parseVersionList(data){
var items=[];
var versionList=$(data).find('table.ms-settingsframe > tbody > tr[class]').each(function(i){
var item={};
if(i > 0 && (i-1) % 2 == 0) {
var row=$(this);
item.version=row.prev().find('td:first').html().trim();
item.modified=row.prev().find('td.ms-vb').find('a').html().trim();
item.editor=row.prev().find('td.ms-vb2').find('a.ms-subtleLink').html().trim();
item.notes=row.find('tr[id*="ProjectUpdates"] > td.ms-vb:not(:empty)').text();
item.changes=[];
row.find('tr[title]:not([id*="ProjectUpdates"])').each(function(){
var previous=$(this).attr('title').split(': ');
var field=$(this).find('td.ms-propertysheet').html().trim();
var newValue=$(this).find('td.ms-vb').html().trim();
var change={field:field,preV:previous[1],newV:newValue};
item.changes.push(change);
});
items.push(item);
}
});
return items;
}
Your mileage may vary on that, but that appears to be all the correct classes/elements for parsing the HTML on the version history page. getVersionHistory(), given the list's GUID and item ID, returns an object that I then pass into a handlebars template for rendering a nice little Office UI-ish card.
Now, to my actual problem: on the version history page, anything over 250 characters in the append-only comments (AOC) field gets cut. But only on the version history page. If I look at the edit form with the AOC, you can see the full text.
So, therein lies my dilemma. What would you all do with this? Should I scrape up the previous AOC entries from the edit form and try and shoehorn them into my version history object somehow? Should I stop trying to placate my users and let them deal with an edit form that can scroll out to infinity when the AOC entries get voluminous?