I am creating my first Nintex workflow and thanks to a couple very helpful people on these discussion boards am close to completion. The last thing I need to build is a system for sending out the status of the items in the list in a weekly update email so that it can be printed out and disiplayed for everyone to see what is happening with the items they submitted. I have googled and found some articles on how to compile items into a table and email them but even these are a bit too advanced for me to work through alone.
Could anyone help me get started? I am trying ot implement the method discussed in the article linked below but do not know how to start by storing my data in a multiline field as xml (excerpt quoted below). I am just using a simple list and single workflow built on that list, no Nintex Forms.
"First thing we need to do is to create some collection variables and populate them with data.. In my example I’m using Nintex Forms and some repeating section controls. These control store the multiple rows of information into a multiline field as xml. This allows me to use the ‘Query XML‘ action to get the values out and store them into a collection variable."
Thank you for any direction you can provide.
If this is your first Nintex workflow then the method I'm suggesting may be too complicated for your scenario, but exactly for this kind of task a combination of web services (GetListItems of Lists.asmx) and XSL would be the perfect fit (I made very good experiences with it and it simplifies the workflow a lot, except the kind of "complicated" actions of course).
With this approach you'd only need three actions in the workflow:
Vadim Tabakman wrote an excellent post for this method Nintex Workflow - XSL Transformation - Vadim Tabakman which was the starting point for me (I did not know anything about XSL before).
Hi Martin, thanks a lot for the reply.
In the Call Web Service action, if I want to return all items from a certain list and view and use listName and viewName, do I need to use any of the other fields to specify anything? And what do I store the output in? A variable of type multiple lines of text?
It seems like in your attached tutorial the creator does everything within the call web service action.
I appreciate the help and understand if you don't have the time to walk me through this.
To be honest, when I created this example I realized that the "Call a web service" action is far more complicated than I remembered (I'm doing these steps automatically, so I don't "realize" anymore what an effort it is... ).
Ok, we have a list with the (internal) field names "Title" and "Status".
Add a "Call a web service" action to your workflow, use "Web URL" (Common Workflow Variable) and "/_vti_bin/Lists.asmx" as the URL, enter your credentials (best practice is to use a service account here) and press the "Refresh Button".
The drop down will be populated, select "GetListItems" from the list.
Now, unfortunately the SOAP created by the simple Nintex mask (=SOAP Builder) is buggy, so you have to change to "SOAP editor" and edit the SOAP manually. So, switch to "SOAP editor", the single text fields disappear and you have a multiline textbox with the complete SOAP.
Edit the parameters as shown below.
Note, I'm always using the IDs of the list and the view (including the curly brackets), since a list and a view name can be changed, but not the ID. A great tool to get the ID (and for other things) ist the "Stramit CAML Viewer 2007": http://spcamlviewer.codeplex.com/
Enter empty nodes for "<ViewFields />" and "<QueryOptions />", otherwise you will get a "Root node missing" error when running the workflow (this is the buggy part of the SOAP builder).
If your default view contains all the elements you want to send, you can leave <viewName> empty. You don't need any other values, check out http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx for their meaning.
You can run the action now (use the "Run now" button) and you already should get back the XML of your list items.
Now for the hard part, the XSLT...
You can take the example Vadim Tabakman is providing in his blog entry and modify it to your needs. The key thing to remember is that you access the field values by using the internal field name and the prefix "@ows_" (@ because they're attributes).
So to first find all your rows, you use the xpath query "//z:row" and inside the z:row template you're accessing the values with <xsl:value-of select="@ows_Title" /> or <xsl:value-of select="@ows_Status" /> . So, in our example the stylesheet would look like this:
And the output would be:
And yes, you're right, you can do everything in only two steps. For this add the XSL in the box below "Result processing" in the "Call a web service action" (do not tick "Force top level XML node") and save the output in a multiline variable.
This variable contains the HTML which you can use in your email body in the "Send notification" action.
I attached the stylesheet I used for this example and the workflow (with the "Call a web service" action only) as well.
I can't thank you enough for this in depth explanation. You have gone above and beyond to simplify this for me.
I am sorry for taking so long to get back on this, I hope you might still be available to help. When I use the "Run Now" button nothing is being returned in the results field. I had to use the actual list name and view name because I am getting an error when trying to use the tool you provided to procure the ID's.
Do you perhaps see some silly error I am making? Unfortunately I have to admit I am just trying to match up your stuff to fit mine without really understanding much.
<?xml version="1.0" encoding="utf-8"?>
<m:listName>Submit Change Request</m:listName>
No, I don't see an error in your XML at first sight. What you mean by "nothing is returned on 'Run now'"? Is the result box completely empty or do you have the result XML but no rows inside it?
To get the list (and view) ID I just found another little helper tool: http://meyerweb.com/eric/tools/dencoder/, where you can just enter the URL and it will decode the IDs for you (go to your list and the view you want to query, click on "Modify View" and copy this URL into the text box on the "URL Decoder/Encoder" page.
Maybe it works with the IDs, but to be honest, at the moment I don't see the problem. Do you see list items when you call this view in the browser?
Brilliant! Worked perfectly. I used the List and View GUIDs with success:
<?xml version="1.0" encoding="utf-8"?>
I just copied the XSLT in the example for my initial testing to ensure it worked, and it did.