Solved

Ever growing latest version history comment, how do I get only the very last?

  • 31 March 2021
  • 1 reply
  • 54 views

in order to create a workflow to update title field with name-field value, on a list where check-out is mandatory, I had to do the check-out / check-in rutine, but checking in overwrites the "comments on check-in" field and leaves it empty.

so I found: How to get latest version history comment which, to some extent works fine... it works..BUT:

it is keeping all the latest comments, and the field is growing and growing, it even takes the comments from other fields and adds them also.

 

17243i243F3E425EB1ADF3.png

 

So how do I limit it to ONLY the very last comment?

 

icon

Best answer by MrCapion 31 March 2021, 13:12

View original

1 reply

hmm. how to mark as solved by one self?  😀

the call webservice for "versions" is "standard":

the web-URL_with/_vti_bin/Versions.asmx

web method: getversions

filename string :  item URL 

 

store result in:  a text-variable ( single line which I named  "tmp_comment" )

 

then:

Query XML

 

XML-Source:

{WorkflowVariable:tmp_comment}

 

process using: Xpath

//defaultNS:result/@comments

 

store in: a text-variable ( single line which I named "Newcom" )

 

Then:

Check OUT > current..   ( has to be checked out in this list, made mandatory in by me )

 

In between here I actually copies the filename IF is changed to the Title field.

( the strange lack of function i SharePoint, where uploaded files is stored i a "name" field, and "title" left unused, so no one can use it for a lookup field. )

 

Then:

Check IN: 

from: Current

Comments: {WorkflowVariable:newcom}

 

Check in type: Major ( i did not see any change in the version anyway, it kept my "current version" )

 

but, bottom line, I made it work that way.

It copies my comment at check in, stores it, 

Reply