History States
How do i get the history (previous states) of a workitem?
|
5 answers
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. |
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 |
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 |
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 |
Great... it worked! Thanks.
Hi |
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.