Extract last update from versioned multi-line text field

  • 15 February 2017
  • 13 replies
  • 17 views

Badge +7

I have a multi-line text field which contains updates on the item, so I have append changes turned on, and therefore, all the comments are stored in version history, not in the text field.  I need to extract the last update from the version history to include in a workflow email notification.  Image of the text I am referring to is attached.  Any suggestions?


13 replies

Userlevel 5
Badge +14

you will have to use Lists.asmx's web service method   GetVersionCollection

Lists.GetVersionCollection Method (Lists) 

Userlevel 4
Badge +12

Had a very similar task in the past. Best solution for us was not to use the versioned comment field but writing every comment entered in one field summarized in a multi line text field that is moderated by the workflow. This way you have everything in one field and you don't rely on the versioning stuff as old versions could be deleted by policies and so on.

So basically a workflow grabs the text from field 1, combines all comments in field 2 and clears field 1 afterwards so it's free for a new comment. In your form you would show field 2 as read only and have your comment history there.

Would that work for you?

Kind regards,

Enrico

Badge +7

I am not a developer.  How would I use this in a workflow?

Userlevel 5
Badge +14

would this help Nintex webserice xml to xslt processing with date filed ?

you need not necessarily use XSLT to pick data from result, you could use query XML

Userlevel 5
Badge +13

This is also what we did as a solution. You could then include the "field 1" in your email and get just the most recent update

Badge +7

No I did not find this helpful at all.  What i am looking for is an explanation of how to use the Lists.asmx's web service method GetVersionCollection that you referenced in your first reply.

Badge +7

Do you get the date/time and user name stamps that versioning applies automatically, or did you find a way to capture that?

Badge +7

I apologize...I marked you not helpful by mistake...No, I am still trying to figure out how to use Marian's method, but might end up going with Enrico's method.

Userlevel 5
Badge +13

Hey Ellen,

I did capture the "modifying user" and "date/time" in mine using my workflow.

Here's how I did it:

I have a setVariable action where I pull in my "archive" comments, then a set variable action where I pull in my "new comments" (most recent ones), then a set variable where I get "todays Date" (using the "Use date when action was executed"). Then I set a variable "editing User" to "current Item: Modified By". Keep in mind, that we can set all these variables in one "Set Variable" Action!

Once you set all your variables, you can build a string with all these pieces. So our string looks like:

modifyingUser | modifyingDate: newUpdate

archiveComments

and I output that to string "outputcomments" then set my archive column to that variable and tada! So as I update, my archive comments field starts to look like this:

200725_pastedImage_1.png

If you want, you can put a runIf in there to make sure "new comments" isn't empty. Basically, you'd still set your "new Comments" variable, and then have a "Run If new comments != null" to set the archive comment. That would prevent getting "blank" updates like I have.

Let me know if you need more screenshots or step by step stuff!

Userlevel 5
Badge +14

I think it's quite easy - call webservice action configuration dialog navigates you what input it expects

webservice returns you a xml response wich you need to parse for data you are interested in.

as I suggested above you could do it with Query XML action.

Badge +7

I was able to get some help on this from one of my colleagues who is pretty good with XML and we were able to get it working with Marian's suggestion of using the GetVersionCollection method of the List.asmx web service.  We had to do a little more configuring to get a non-blank comment value.  Thank you, Marian, and others, who also gave helpful suggestions, which I might use on a future project.  I documented the configuration, so if anyone else ever needs to be able to accomplish this same thing, let me know and I will share with you.  I would have attached here, but couldn't find a way to add an attachment to a reply.

Badge

Hi! I'm a newbie and trying to use this solution however I am not familiar with XML. And I'm stuck on what to use for the Web service inputs (see below).7239iC37DA55C814535CD.png

 

This is what I used and what I see when I run it:

7242iB8809AE9639C383B.png

 

Can someone tell me what I am doing wrong?

 

Thanks you in advance!

Lorraine

Userlevel 5
Badge +12
Hi Lorraine,

You will get this when using variables to test the query, as the query test is running without context (because the workflow has not run on an item yet) that variable for the Item ID is not populated and will return a 500 error.

The best way to test queries is to use a known good hard coded ID of an item first, make sure the query works with that and then you can safely change it to a variable after testing.

Hope this helps.

Reply