0

I have a Task List with Versioning enabled. The issue I now have is we have a requirement to view/print the list item with all the notes with date/time stamps for an audit.

Is there a simple way to do this?

0

Had a similar request. Ended up using SPServices GetVersionCollection to grab the version information and then append it to my display form. The snippet I used stemmed from this post: https://sharepoint.stackexchange.com/a/26114

The general purpose for my use was to grab the version where a user changed the Status field from Pending to Completed, see who did it and when, and then append that information to a Div I setup at the bottom of my form:

$( document ).ready(function() {

//get the item ID from the URL
var currentUrl = window.location.href;
var itemID = currentUrl.substring(currentUrl.indexOf("=")+1, currentUrl.indexOf("&"));

$().SPServices({
  operation: "GetVersionCollection",
  async: false,
  strlistID: "My List",
  strlistItemID: itemID,
  strFieldName: "Status",
  completefunc: function (xData, Status) {
  $(xData.responseText).find("Version").each(function(is, val) {
      var status = $(this).attr("Status");
      var editor = $(this).attr("Editor");
      //Parse out the Display Name
      var editorSub = editor.substring(editor.indexOf(";")+2,editor.indexOf(","));
      var compDate = $(this).attr("Modified");
      //Using Moment.js to format the date
      var compDateFormatted = moment(compDate).format("MMMM Do YYYY, h:mm a");
      //This portion checked to make sure that the item was just changed from Pending to Completed and wouldnt change if another field was updated after the change.
      //Basically just checks the field in the previous version 
      var nextCheck = $(this).next().attr("Status");
      if (status == "Completed" && nextCheck == "Pending"){
          $('#myDiv').append("<p>Marked Completed By " + editorSub + " on "+ compDateFormatted+"</p>");
      }else{
          //do nothing
      }
     }); 
    }
   }); 
  }); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.