It's all about the answers!

Ask a question

History States


Pratik Bengali (2651) | asked Mar 16 '09, 11:05 p.m.
How do i get the history (previous states) of a workitem?

5 answers



permanent link
Robin Bobbitt (59679) | answered Oct 30 '09, 10:58 a.m.
Great... it worked! Thanks.
Hi
You can use the corresponding IItemType to do this. E.g. for a work item handle:
IWorkItem.ITEM_TYPE.createItemHandle(Object origin, UUID itemId, UUID optionalStateId);

Regards

Marcel
Jazz Work Item team

permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Oct 30 '09, 3:36 a.m.
JAZZ DEVELOPER
Hi
You can use the corresponding IItemType to do this. E.g. for a work item handle:
IWorkItem.ITEM_TYPE.createItemHandle(Object origin, UUID itemId, UUID optionalStateId);

Regards

Marcel
Jazz Work Item team

permanent link
Robin Bobbitt (59679) | answered Oct 29 '09, 3:07 p.m.
I'm trying to retrieve a previous state of an Auditable. If I have the UUID of the state I'm looking for, is there a way to retrieve this state directly, rather than doing IRepositoryItemService.fetchAllStates and iterating through to find the item with the right state? I was thinking I could maybe create an item handle and set the state on that, then fetch the item, but there doesn't seem to be an API to set the state. Thanks!

Hi
To get to the previous item states of the work item, you can use

RepositoryItemService#fetchAllStates
an for each of these handles you can do:
RepositoryItemService#fetchState

Then you have a work item where you can read the workflow state as you do in your code snippet.

Regards

Marcel
Jazz Work Item team

permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Mar 18 '09, 10:08 a.m.
JAZZ DEVELOPER
Hi
To get to the previous item states of the work item, you can use

RepositoryItemService#fetchAllStates
an for each of these handles you can do:
RepositoryItemService#fetchState

Then you have a work item where you can read the workflow state as you do in your code snippet.

Regards

Marcel
Jazz Work Item team

permanent link
Pratik Bengali (2651) | answered Mar 17 '09, 6:09 p.m.
Below is my code in WorkItem Save precondition.

//getServices
IWorkItemServer workItemServer = getService(IWorkItemServer.class);

IWorkItem workItem_newstate = (IWorkItem)saveOperation.getNewState().getFullState();
Identifier<IState> workItemNewState = workItem_newstate.getState2();
IWorkflowInfo workflowInfoNew = workItemServer.findWorkflowInfo(workItem_newstate, monitor);
String stateName_new = workflowInfoNew.getStateName(workItemNewState);


How can I get the previous (history) state of the workitem? I am having hard time to figure this code out.

There are only two forum entries, but it is very hard to figure out the API part
https://jazz.net/forums/viewtopic.php?t=1823&highlight=work+item+history
https://jazz.net/forums/viewtopic.php?t=217&highlight=work+item+history


Thanks.

Your answer


Register or to post your answer.