Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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);
String htmlContent = history[0].getHtmlContent(); // ???
Any advice?
Thanks in advance.

0 votes



7 answers

Permanent link

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.

1 vote


Permanent link

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/*)

1 vote


Permanent link
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,

0 votes


Permanent link
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.

0 votes


Permanent link
the action itself is not saved, also the changes to the process config are not saved in the history
Well, 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.

0 votes

Comments

Enhancement 386170


Permanent link

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:

stateTransitionsitions

It has the following properties:

helperId

transitionDate

action

sourceStateId

sourceResolutionId

sourceWorkflowId

targetStateId

targetResolutionId

targetWorkflowId

changedBy

sourceProjectArea

targetProjectArea

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.

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Mar 04 '16, 10:20 a.m.

Question was seen: 3,987 times

Last updated: Mar 08 '16, 8:26 a.m.

Confirmation Cancel Confirm