History of workitem via OSLC for state changes
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
Hello,
I need to check when an item state was changed with its timestamp.
I used the following call to retrieve the list of states changes with their modified timestamps however it returns all modified actions - I need to return only when the states were changed. How can I do that via OSLC?
https://server:port/ccm/rpt/repository/workitem?fields=workitem/workItem[id=100]/(itemHistory/(state/*%7Cmodified/*))
Thanks
Accepted answer
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
I don't think you can see a "change" in a single history record, because only the state for that moment is recorded. You will need to compare the state with the previous history record to see if there is a "change in state". No "actions" are recorded in the history.
Note that you did not have any filtering in your original URL. That URL is requesting both the "state" and "modified" attributes of the "itemHistory" record. Using square brackets for filtering - the same way you use [id=100] for work item filtering. For example, if you want to get the history records with state "Closed" for work item #100, use URL below
Note that you did not have any filtering in your original URL. That URL is requesting both the "state" and "modified" attributes of the "itemHistory" record. Using square brackets for filtering - the same way you use [id=100] for work item filtering. For example, if you want to get the history records with state "Closed" for work item #100, use URL below
https://<server>:<port>/ccm/rpt/repository/workitem?fields=workitem/workItem[id=100]/(itemHistory/(state[name="Closed"]/*|modified))To achieve what you want to do, you need to do some processing, due to the reason stated earlier. You would need this URL. You will need all the history records of the work item since you do not know which history record holds the "previous" state.
https://<server>:<port>/ccm/rpt/repository/workitem?fields=workitem/workItem[id=100]/(itemHistory/(state/*|modified|stateId|predecessor))The key is the attributes "stateId" and "predecessor". "stateId" is the Id of the containing history record, and "predecessor" is the Id of the previous history record. Of course you can also sort the history records by the "modified" attributes so that they are in order. As stated earlier, if you compare the state with the one in the previous history record and see that they are different, you observe a "change of state".
Comments
sam detweiler
Jun 10 '14, 5:39 p.m.I don't know if there is filtering on this data set.
EclipseTalk .
Jun 11 '14, 9:54 a.m.If there is no filtering, is it possible to get the list of the previous states versus actual states with timestamp?