It's all about the answers!

Ask a question

History of workitem via OSLC for state changes


EclipseTalk . (32736061) | asked Jun 10 '14, 5:10 p.m.
edited Jun 10 '14, 5:22 p.m.
 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

Comments
sam detweiler commented Jun 10 '14, 5:39 p.m.

I don't know if there is filtering on this data set.


EclipseTalk . commented Jun 11 '14, 9:39 a.m. | edited 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?

Thanks,

Accepted answer


permanent link
Donald Nong (14.5k414) | answered Jun 12 '14, 3:01 a.m.
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
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".

EclipseTalk . selected this answer as the correct answer

Comments
EclipseTalk . commented Jun 17 '14, 11:44 a.m.

 Thanks Don - I'll look into it.


EclipseTalk . commented Jun 17 '14, 11:45 a.m.

Thanks Donald - I'll look into it. 

Your answer


Register or 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.