cancel
Showing results for 
Search instead for 
Did you mean: 
cvuppala
Nintex Newbie

Tracking Version History and version comments using Nintex workflow

Jump to solution

Hi,

Here is my scenario. 

1) User updates an office document (most likely word /powerpoint/excel) to a SharePoint Document library. A new version is created every time an update is made to the document. 

2) The requirement is to update the word document with entries of version history and associated version comments if any.

3) Essentially, I would like to update the word document with a table of entries where each row will have a version #, Check in comments. 

Is it possible using content controls for word documents? how do we handle this situation for Excel documents where there is no concept of content controls.

Please advise...this is a nice feature that Nintex can help us.

0 Kudos
Reply
12 Replies
Highlighted
Automation Master
Automation Master

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

See this for reference:

How to get latest version history comment 

Search for the topic on the community (before posting the question) to get more similar ones.

View solution in original post

Reply
cvuppala
Nintex Newbie

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Hi Kapil,

Thank you for your response. 

My question was much broader than what you have outlined. I am aware of Versions.asmx webservice. My challenge is how to translate version history into updated Word document as a table. I started using content control to post latest version comment.  However, it would overwrite content control content that was updated for previous version comment.

In summary:

I need to build version history inside the word document that is being updated in SharePoint Document library.

I hope my question is clear...

Thanks, 

0 Kudos
Reply
Automation Master
Automation Master

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Hi,

You can always append to the text that is shown in the content control.

The field that is referenced in content control on the word document will already have text in it. In your workflow, save that into a variable or multiple line text. 

Once you have retrieved the latest version using the web servivce, append it to the variable and save it back in the variable using Build String.

Once you set the value of the field in the library, the content control should show the new text. Hope that helps.

0 Kudos
Reply
cvuppala
Nintex Newbie

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

So here is what I did...

1) Called the Versions.asmx webservice on an item update. (please note that I can't get latest version through a webservice call. I can only get an XML of all the versions and associated comments like so:

<results xmlns="http://schemas.microsoft.com/sharepoint/soap/">   <list id="{26E516B0-8241-4B97-984D-000000000000}" />      <versioning enabled="1" />   <settings url="http://Server_Name/Site_Name/_layouts/          1033/LstSetng.aspx?       List={26E516B0-8241-4B97-984D-000000000000}" />    <result version="@4" url="http://Server_Name/Site_Name/          Shared Documents/File_Name.doc"        created="6/7/2003 5:55 PM" createdBy="DOMAIN\User" size="19968"           comments="" />    <result version="1" url="http://Server_Name/Site_Name/          _vti_history/1/Shared Documents/File_Name.doc"        created="6/7/2003 5:49 PM" createdBy="DOMAIN\User" size="19968"           comments="" />       .       .       .</results>

2) Now how do I traverse through the above XML using foreach so that each result XML element is transformed into a table row?

3) once i figure out step 2, I can use build string to build whatever string I want to display in my content control.

Please advise,

0 Kudos
Reply
cvuppala
Nintex Newbie

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Hello Moderator, 

I need some help here. My question is:

How do I traverse through the Versions XML that I fetched using versions.asmx. Can I use for each action to iterate through an XML? or is for each restricted only to a collection? 

The reason I would like to do this is that, I need to build a string that will output a table row for each xml element of the versions XML.

I am kind of stuck with this step,

Please advise,

0 Kudos
Reply
Automation Master
Automation Master

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Hi,

After the Call Web Service action, add Query XML action.

Use the XML generated in the web service action as the source, and enter xpath as //@version or //@<any other node>

This will give you the collection. Similarly you can get the details of the version by adding multiple XPATH and storing them in the collection variables, click on +Add output .

See an example below:

Use the resultant collection in the for-each loop to create readable text. Hope this helps.

0 Kudos
Reply
cvuppala
Nintex Newbie

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Hi Kapil,

Thank you for your suggestion. I will definitely give it a try. Here is something that I tried where I am almost close to achieve the functionality that I am looking for.

I developed an XSLT stylesheet and applied it to the web service result XML. I think Nintex allows you an option to either Query XML using xpath or transform the XML to a format that you want. 

So, below is my XSLT that will take the webservice result xml as the source and transform into a HTML.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslSmiley Surprisedutput method="html"/>
<xsl:template match="/">
<table>
<tbody>
<xsl:apply-templates select="*" mode="row"/>
</tbody>
</table>
</xsl:template>
<xsl:template match="result" mode="row">
<tr>
<td>
<xsl:value-of select="@createdByName"/>
</td>
<td>
<xsl:value-of select="@version"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>

I was able to build the HTML and set it to a text field on the document library. However, how will I copy this HTML into word document content control so that it will show the table and not the actual HTML mark up? that will be the next challenge right?

Any ideas?

0 Kudos
Reply
cvuppala
Nintex Newbie

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Additional Details

1. Applied Stylesheet to Versions XML.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlnsSmiley Tongue="http://schemas.microsoft.com/sharepoint/soap/">
<xslSmiley Surprisedutput method="html"/>
<xsl:template match="/">
<table>
<tbody>
<xsl:apply-templates select="//p:result">
<xsl:sort select="substring-after(@version, '@')"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:template>
<xsl:template match="p:result">
<tr>
<td>
<xsl:value-of select="position()"/>
</td>
<td>
<xsl:value-of select="@createdByName"/>
</td>
<td>
<xsl:text>Version</xsl:text>
<xsl:text></xsl:text>
<xsl:value-of select="@version"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>

2. Output from the Transformation is copied to a Multi-line text Field on the document library. Please note that document libraries do not have a rich text field associated with them. so, anything we write to a multi line text field is copied as plain text.

<table
xmlnsSmiley Tongue="http://schemas.microsoft.com/sharepoint/soap/">
<tbody>
<tr>
<td>1</td>
<td>John doe</td>
<td>Version 1.0</td>
</tr>
<tr>
<td>2</td>
<td>John doe</td>
<td>Version 2.0</td>
</tr>
<tr>
<td>3</td>
<td>John doe</td>
<td>Version 3.0</td>
</tr>
<tr>
<td>4</td>
<td>John doe</td>
<td>Version 4.0</td>
</tr>
<tr>
<td>5</td>
<td>John doe</td>
<td>Version 5.0</td>
</tr>
<tr>
<td>6</td>
<td>John doe</td>
<td>Version 6.0</td>
</tr>
<tr>
<td>7</td>
<td>John doe</td>
<td>Version 7.0</td>
</tr>
<tr>
<td>8</td>
<td>John doe</td>
<td>Version 8.0</td>
</tr>
<tr>
<td>9</td>
<td>John doe</td>
<td>Version 9.0</td>
</tr>
<tr>
<td>10</td>
<td>John doe</td>
<td>Version 10.0</td>
</tr>
<tr>
<td>11</td>
<td>John doe</td>
<td>Version 11.0</td>
</tr>
<tr>
<td>12</td>
<td>John doe</td>
<td>Version 12.0</td>
</tr>
<tr>
<td>13</td>
<td>John doe</td>
<td>Version 13.0</td>
</tr>
<tr>
<td>14</td>
<td>John doe</td>
<td>Version 14.0</td>
</tr>
<tr>
<td>15</td>
<td>John doe</td>
<td>Version 15.0</td>
</tr>
<tr>
<td>16</td>
<td>John doe</td>
<td>Version 16.0</td>
</tr>
<tr>
<td>17</td>
<td>John doe</td>
<td>Version 17.0</td>
</tr>
<tr>
<td>18</td>
<td>John doe</td>
<td>Version 18.0</td>
</tr>
<tr>
<td>19</td>
<td>John doe</td>
<td>Version 19.0</td>
</tr>
<tr>
<td>20</td>
<td>John doe</td>
<td>Version 20.0</td>
</tr>
<tr>
<td>21</td>
<td>John doe</td>
<td>Version 21.0</td>
</tr>
<tr>
<td>22</td>
<td>John doe</td>
<td>Version 22.0</td>
</tr>
<tr>
<td>23</td>
<td>John doe</td>
<td>Version 23.0</td>
</tr>
<tr>
<td>24</td>
<td>John doe</td>
<td>Version 24.0</td>
</tr>
<tr>
<td>25</td>
<td>John doe</td>
<td>Version 25.0</td>
</tr>
<tr>
<td>26</td>
<td>John doe</td>
<td>Version 26.0</td>
</tr>
<tr>
<td>27</td>
<td>John doe</td>
<td>Version 27.0</td>
</tr>
<tr>
<td>28</td>
<td>John doe</td>
<td>Version 28.0</td>
</tr>
<tr>
<td>29</td>
<td>John doe</td>
<td>Version 29.0</td>
</tr>
<tr>
<td>30</td>
<td>John doe</td>
<td>Version 30.0</td>
</tr>
<tr>
<td>31</td>
<td>John doe</td>
<td>Version 31.0</td>
</tr>
<tr>
<td>32</td>
<td>John doe</td>
<td>Version 32.0</td>
</tr>
<tr>
<td>33</td>
<td>John doe</td>
<td>Version 33.0</td>
</tr>
<tr>
<td>34</td>
<td>John doe</td>
<td>Version 34.0</td>
</tr>
<tr>
<td>35</td>
<td>John doe</td>
<td>Version 35.0</td>
</tr>
<tr>
<td>36</td>
<td>John doe</td>
<td>Version 36.0</td>
</tr>
<tr>
<td>37</td>
<td>John doe</td>
<td>Version 37.0</td>
</tr>
<tr>
<td>38</td>
<td>John doe</td>
<td>Version 38.0</td>
</tr>
<tr>
<td>39</td>
<td>John doe</td>
<td>Version 39.0</td>
</tr>
<tr>
<td>40</td>
<td>John doe</td>
<td>Version 40.0</td>
</tr>
<tr>
<td>41</td>
<td>John doe</td>
<td>Version 41.0</td>
</tr>
<tr>
<td>42</td>
<td>John doe</td>
<td>Version 42.0</td>
</tr>
<tr>
<td>43</td>
<td>John doe</td>
<td>Version 43.0</td>
</tr>
<tr>
<td>44</td>
<td>John doe</td>
<td>Version 44.0</td>
</tr>
<tr>
<td>45</td>
<td>John doe</td>
<td>Version 45.0</td>
</tr>
<tr>
<td>46</td>
<td>John doe</td>
<td>Version 46.0</td>
</tr>
<tr>
<td>47</td>
<td>John doe</td>
<td>Version 47.0</td>
</tr>
<tr>
<td>48</td>
<td>John doe</td>
<td>Version 48.0</td>
</tr>
<tr>
<td>49</td>
<td>John doe</td>
<td>Version 49.0</td>
</tr>
<tr>
<td>50</td>
<td>John doe</td>
<td>Version 50.0</td>
</tr>
<tr>
<td>51</td>
<td>John doe</td>
<td>Version 51.0</td>
</tr>
<tr>
<td>52</td>
<td>John doe</td>
<td>Version 52.0</td>
</tr>
<tr>
<td>53</td>
<td>John doe</td>
<td>Version 53.0</td>
</tr>
<tr>
<td>54</td>
<td>John doe</td>
<td>Version 54.0</td>
</tr>
<tr>
<td>55</td>
<td>John doe</td>
<td>Version 55.0</td>
</tr>
<tr>
<td>56</td>
<td>John doe</td>
<td>Version 56.0</td>
</tr>
<tr>
<td>57</td>
<td>John doe</td>
<td>Version 57.0</td>
</tr>
<tr>
<td>58</td>
<td>John doe</td>
<td>Version 58.0</td>
</tr>
<tr>
<td>59</td>
<td>John doe</td>
<td>Version 59.0</td>
</tr>
<tr>
<td>60</td>
<td>John doe</td>
<td>Version 60.0</td>
</tr>
<tr>
<td>61</td>
<td>John doe</td>
<td>Version 61.0</td>
</tr>
<tr>
<td>62</td>
<td>John doe</td>
<td>Version 62.0</td>
</tr>
<tr>
<td>63</td>
<td>John doe</td>
<td>Version 63.0</td>
</tr>
<tr>
<td>64</td>
<td>John doe</td>
<td>Version 64.0</td>
</tr>
<tr>
<td>65</td>
<td>John doe</td>
<td>Version 65.0</td>
</tr>
<tr>
<td>66</td>
<td>John doe</td>
<td>Version 66.0</td>
</tr>
<tr>
<td>67</td>
<td>John doe</td>
<td>Version 67.0</td>
</tr>
<tr>
<td>68</td>
<td>John doe</td>
<td>Version 68.0</td>
</tr>
<tr>
<td>69</td>
<td>John doe</td>
<td>Version 69.0</td>
</tr>
<tr>
<td>70</td>
<td>John doe</td>
<td>Version 70.0</td>
</tr>
<tr>
<td>71</td>
<td>John doe</td>
<td>Version 71.0</td>
</tr>
<tr>
<td>72</td>
<td>John doe</td>
<td>Version 72.0</td>
</tr>
<tr>
<td>73</td>
<td>John doe</td>
<td>Version 73.0</td>
</tr>
<tr>
<td>74</td>
<td>John doe</td>
<td>Version 74.0</td>
</tr>
<tr>
<td>75</td>
<td>John doe</td>
<td>Version 75.0</td>
</tr>
<tr>
<td>76</td>
<td>John doe</td>
<td>Version 76.0</td>
</tr>
<tr>
<td>77</td>
<td>John doe</td>
<td>Version 77.0</td>
</tr>
<tr>
<td>78</td>
<td>John doe</td>
<td>Version 78.0</td>
</tr>
<tr>
<td>79</td>
<td>John doe</td>
<td>Version 79.0</td>
</tr>
<tr>
<td>80</td>
<td>John doe</td>
<td>Version 80.0</td>
</tr>
<tr>
<td>81</td>
<td>John doe</td>
<td>Version 81.0</td>
</tr>
<tr>
<td>82</td>
<td>John doe</td>
<td>Version 82.0</td>
</tr>
<tr>
<td>83</td>
<td>John doe</td>
<td>Version 83.0</td>
</tr>
<tr>
<td>84</td>
<td>John doe</td>
<td>Version 84.0</td>
</tr>
<tr>
<td>85</td>
<td>John doe</td>
<td>Version 85.0</td>
</tr>
<tr>
<td>86</td>
<td>John doe</td>
<td>Version 86.0</td>
</tr>
<tr>
<td>87</td>
<td>John doe</td>
<td>Version 87.0</td>
</tr>
<tr>
<td>88</td>
<td>John doe</td>
<td>Version 88.0</td>
</tr>
<tr>
<td>89</td>
<td>John doe</td>
<td>Version 89.0</td>
</tr>
<tr>
<td>90</td>
<td>John doe</td>
<td>Version 90.0</td>
</tr>
<tr>
<td>91</td>
<td>John doe</td>
<td>Version 91.0</td>
</tr>
<tr>
<td>92</td>
<td>John doe</td>
<td>Version 92.0</td>
</tr>
<tr>
<td>93</td>
<td>John doe</td>
<td>Version 93.0</td>
</tr>
<tr>
<td>94</td>
<td>John doe</td>
<td>Version 94.0</td>
</tr>
<tr>
<td>95</td>
<td>John doe</td>
<td>Version 95.0</td>
</tr>
<tr>
<td>96</td>
<td>John doe</td>
<td>Version 96.0</td>
</tr>
<tr>
<td>97</td>
<td>John doe</td>
<td>Version 97.0</td>
</tr>
<tr>
<td>98</td>
<td>John doe</td>
<td>Version @98.0</td>
</tr>
</tbody>
</table>

3) Copied above HTML into the content control.  But, the table is shown as HTML table. How do we convert this to show as word table? 

Please help,

0 Kudos
Reply
Automation Master
Automation Master

Re: Tracking Version History and version comments using Nintex workflow

Jump to solution

Either way, XPATH or XSLT, you do not need to create html out of it. Word document will not render the html tags as table.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p="http://schemas.microsoft.com/sharepoint/soap/">

<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="//p:result">
<xsl:sort select="substring-after(@version, '@')"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="p:result">
<xsl:value-of select="position()"/>| <xsl:value-of select="@createdByName"/>| <xsl:text>Version </xsl:text><xsl:text></xsl:text><xsl:value-of select="@version"/>;
</xsl:template>
</xsl:stylesheet>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This will give you a collection, just save this collection into a multiple line field using For-Each loop reading the rows 1 by 1. It will not be tabulated format I guess.

0 Kudos
Reply