How to get stateId value from itemHIstory, using REST API (or JAVA API as well)
![]()
I am using EWM 7.0.2
If I run this on a workItem using REST API:
:
https://.../ccm/rpt/repository/workitem?size=10&fields=workitem/workItem[id=196902]/(itemHistory/)
I get the workItemHistory of workItem 196872. And i get this:
<workitem Version="1.0.0" rel="next" href="https://...l/ccm/rpt/repository/workitem?id=_Kq4-IEJNEey5E-m8MK5izA&fields=workitem%2FworkItem%5Bid%3D196872%5D%2F%28itemHistory%2F%29&size=10&pos=10">
<workItem>
<itemHistory>
<uniqueId>c047b1efb868e59aab35350cd22e0179</uniqueId>
<reportableUrl>https://.../ccm/rpt/repository/workitem/workItem/id/196872</reportableUrl>
<itemType>com.ibm.team.workitem.WorkItem</itemType>
<stateId>_CJPtoQwdEeyZIZVQuvzHnQ</stateId>
<itemId>_s9uYpvYDEeulzYpB_Y0gYw</itemId>
<contextId>_PBXKMN2nEeutoJyYHvgVaA</contextId>
<modified>2021-09-02T12:38:57.914-0600</modified>
<predecessor>_BwzYcgwdEeyZIZVQuvzHnQ</predecessor>
My question is if there is a way to get the literal value of stateId, instead of the String "_CJPtoQwdEeyZIZVQuvzHnQ"
Also a Java API solution is ok.
|
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Nov 11 '21, 11:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER This prints a work item, its ID historical states and the workflow state information for each of those historical states. Marcelo Bilezker selected this answer as the correct answer
|
3 other answers
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Nov 11 '21, 2:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER That stateId does represent the historical state of the work item and not the workflow state of a work item. There is no string representation for it in any API. If you get that historical state of the work item, you could get the workflow state of that version of the work items history. Comments The work item workflow state of a work item can be accessed in the reportable REST api using com.ibm.team.workitem.State see https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#com_ibm_team_workitem_State |
![]()
You point out that:
If you get that historical state of the work item, you could get the workflow state of that version of the work items history.
My question is how i get each workflow historical state you say I could get.
When using the workflow of the workItem, using JAVA API, i get an array with the possible values of states the workitem can be, not the states the workitem has had.
,
Additionally, in the page you recommended:
there is this definition:
itemHistory (type: com.ibm.team.workitem.WorkItem, maxOccurs: unbounded). A collection of zero or more WorkItem elements, representing the entire history of the work item. Each state the work item has ever been in is reflected in this history list.
So, it should be possible to see each of the states a workItem has been.
Comments ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You use the wrong API if you get the workflow state definitions.
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
itemHistory (type: com.ibm.team.workitem.WorkItem, maxOccurs: unbounded). A collection of zero or more WorkItem elements, representing the entire history of the work item. Each state the work item has ever been in is reflected in this history list.
This implies you can get the history states of a work item and maybe even get each state.
|
![]()
I just found how to do the same using JAVA API
I share it in case someone needs it
|
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.