It's all about the answers!

Ask a question

Is there a way to get the work item state date?


Matei Florescu (1524) | asked May 28 '15, 5:00 a.m.
I know there is a way to retrieve the succession of states from the work item history, (https://jazz.net/forum/questions/149321/some-questions-about-reportable-rest-api)
but so far I managed to get only the state name.
Can I get the state date?
By that I mean the date at which an work item changed from "New" to "In progress".
I am not limited to the REST api.

Thank you

Accepted answer


permanent link
Don Yang (7.7k21109138) | answered May 28 '15, 9:04 p.m.
edited May 28 '15, 9:05 p.m.
You can refer to the REST API for more details(https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI)  on what properties can be used in your query in addition to the post you referred to to get the state name. For example, if I add [dayModified] to retrieve workitem 106's history for state as below, it will give me the day modified info:

https://localhost:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[id='106']/(itemHistory/(state/name|dayModified))
Matei Florescu selected this answer as the correct answer

Comments
Matei Florescu commented May 31 '15, 7:12 a.m. | edited May 31 '15, 7:13 a.m.

This helped, I had to modify the query a little:

fields=workitem/workItem[id=...]/(id|summary|itemHistory/dayModified|itemHistory/state/name)

Result is:

    <workItem>
        <id>...</id>
        <summary>...</summary>
        <itemHistory>
            <dayModified>...</dayModified>
            <state>
                <name>Resolved</name>
            </state>
        </itemHistory>
        <itemHistory>
        ...
       

2 other answers



permanent link
Cesar Sasaki (511285124) | answered May 28 '15, 10:21 p.m.
You could create a timestamp attribute to get the date when the workitem got to that state using calculated values scripts. And then query that field.

permanent link
Kevin Ramer (4.5k8183200) | answered May 28 '15, 2:31 p.m.
If you're facile with Java, look at the JavaDoc of the Plain Java client libraries for IAuditableHandle.

public interface IAuditableHandle
extends IManagedItemHandle
	
Represents an auditable item. Auditable items exist in multiple states in a repository. There is a global notion of the current state of an auditable item; states other than the current are used for an audit trail.

Item handles and items can only be created or retrieved from a repository while the client is logged in. When the client logs out, all objects that they obtained while logged in must be considered invalid. It is unspecified whether these objects come back to life, so to speak, if the client logs back in.

I've used this to good effect to tease out the change date of a specific attribute so that the date can be used to answer before/after sort of question.


This post has a small bit of Java that got me started.




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.