My service name is ‘Display History’. This service displays the history for a given instance. For example, the service displays all the associated tasks that have been processed - both open and closed - up until the time the service is executed for a given instance.
Let’s say I want the history for instance 10313. In the service, I defined an input local variable, ‘instanceId’ that is a string - see figure 1. To pass an instanceId=10313 to the service from a web browser, I use the following URl:
http://localhost:7001/teamworks/process.lsw?zWorkflowState=5&zProcessName=Display%20History&tw_local_instanceId=10313
Note: Teamworks requires the parameter to include underscores, so tw_local_instanceId corresponds to service local variable instanceId as is shown in figure 1.
Invoking the above URl from a browser will start the service, pass 10313 to the service and return a list of processed tasks - see figure 2. Note, when I get a chance, I will include the close date (CLOSED_TIMESTAMP) and/or status (STATUS) so users can determine where the task is in the lifecycle, and, more importantly, they will know who to call and pester when a task is sitting idle w/o action. In my ‘real life’ case, I send reminder emails to participants every so often just to keep them in the game.

Figure 1

Figure 2
Additional Info:
See attachment below for SQL query that returns all the tasks for an instance.
See attachment below for the xsl stylesheet that I used to produce the history report. I removed styles for simplicity as I did not want to get into css at this time.
Transform Service:
- Input: 1) xmlString: the xml used in the transform, 2) xslUrl: the url for the stylesheet
- Output: 1) result: the transformed results
var factory = new Packages.org.apache.xalan.processor.TransformerFactoryImpl();
var transformer = factory.newTransformer(new Packages.javax.xml.transform.stream.StreamSource(tw.local.xslUrl));
var input = new Packages.javax.xml.transform.stream.StreamSource(new java.io.StringReader(tw.local.xmlString));
var stringwriter = new java.io.StringWriter();
var result = new Packages.javax.xml.transform.stream.StreamResult(stringwriter);
transformer.transform (input, result);
tw.local.result = stringwriter.toString();
Note: Special thanks goes to Jeoff Wilks from Lombardi for providing assistance with this service.
Attachment:
history.xsl
history.sql
Reference:
Lombardi Wiki Reference