How to get the last work-item action
We need to retrieve the last action performed for a work-item.
In the work-item history we only see the name of the source and target state, but not the name of the action performed. Even the history API service seems to offer only the HTML content for the history:
ChangeLogDTO[] history = wiRepoService.computeHistory(wi);
Any advice?
Thanks in advance.
|
7 answers
If you the Java API as an available tool, you can fetch the workflow definitions and see which actions are available for a given state as well as the target state for those actions. If you know the currents state and the previous state, there should be only one action that could have gotten you to that state. If the Java API is NOT available, then you could hard-code a look-up table in your code. Admittedly, that's not an ideal solution since it would require maintenance whenever a workflow was changed. |
The REST API is really sort of self-documenting and it's unfortunate that wiki page doesn't do a better job of emphasizing that. Try the following URL: https://server:port/ccm/rpt/repository/workitem?fields=workitem/workItem[id=#](*) The asterisk '*' causes the server to response with ALL XML nodes at the top level. If you want nested nodes one level down, you can request (*/*). If you want nodes 3 levels down: (*/*/*) etc... Using this process, you can see all the data the server supplies, even if it's data that isn't documented on the wiki That will reveal that stateTransitions is one of the XML nodes. Once you identify that this node is available, you can investigate that node further: https://server:port/ccm/rpt/repository/workitem?fields=workitem/workItem[id=#](stateTransitions/*)
|
As Nate says, you will have to work it out yourself.. the action itself is not saved.
also the changes to the process config are not saved in the history, |
One of my clients had similar requests (for audit purpose) in the past, and what they ended up is adding a String attribute to hold the sequence of action names and timestamps and assigning its value programmatically.
|
the action itself is not saved, also the changes to the process config are not saved in the historyWell, this appears to us a weak solution for a change and configuration management tool... We will open an enhanchement request for that.
Thank you guys for your answers.
|
I was working on something else today and noticed that the REST API includes definitions for state transitions. In the REST API, there is an attribute node called:
It has the following properties:
It looks like this might be able to get you what you are looking for. I'm not sure why I never noticed it before. I'm not sure if you are working with the REST API or if this would be a viable solution, but there it is for what it's worth. |
Thank you for reporting that, Nate.
Which REST API should we use? We cannot find the attribute node "stateTransitions" on the Wiki page https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#workItem_type_com_ibm_team_worki
Thanks in advance.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.