7

I have been looking for an answer to this question all morning and i cannot find anything to point me in the right direction. We have several customizations to a SharePoint page which displays list data. The column in question is a multi-line text field with append changes enabled. The page is supposed to display the most recent comment from this field and it partially works.

If the last field to be updated in the list item is the comment field (Notes1), then the results will show correctly and the last comment will be displayed (using oListItem.get_item('Notes1')). However, if a user updates any other field in the list item, the results return null until a new comment is added.

Is there any way to get around this? I need to display the last entered comment in this field regardless of which fields were updated. Is it possible to pull all comments from the item or is it possible to retrieve the history of the item using the CSOM?

1

You should use WebServices to get this information.

SPServices offers GetVersionCollection to achieve this with minimal code

Is it possible to get the historical values from a "Append Changes to Existing Text" via JavaScript?

  • Should i assume that this functionality is not available without using the web services? – ps_md Oct 23 '14 at 13:29
  • Yes. I was unable to find another way. – Amal Hashim Oct 23 '14 at 16:48
  • What you're really looking for are the past versions of the list item, so if you can query CSOM for the most recent version (top 1 sorted by Modified descending) where Notes1 is not blank, then that should get you the most recent comment. If you want all comments, you can query all past versions where Notes1 is not blank. – Chris Romp Jan 18 '18 at 18:26
  • The REST endpoint to get the most recent Notes1 comment for item ID 123 would be _api/web/lists/getByTitle('Your List')/Items(123)/Versions?$top=1&$orderby=VersionId desc&$filter=Notes1 ne null. – Chris Romp Jan 18 '18 at 18:32

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.