how to get the history of an work item?
![]()
Hi,
Does anybody know how to get the history of an work item? By history, I mean changes to a given work item. I tried IAuditable.getPredecessorState on an IWorkItem, but when I attempted to get the fields of the predecessor state, I got an IllegalStateException. The error message says "Attempting to get unset feature: InternalState". It's clear that I'm not doing things right, but I have no idea how I should do it correctly. Please help! Thanks! Annie |
Accepted answer
![]()
You probably fetched the work item with only part of its properties, you can use IItemManager.fetchCompleteState() to get the full item in its historical state. If you want to get the full history you can also get all state handles at once using IItemManager.fetchAllStateHandles() instead of walking the history using IAuditable.getPredecessorState().
Regards, Christof Jazz Work Item team Ralph Schoon selected this answer as the correct answer
|
6 other answers
![]()
You can use IItem.modified() (which returns a Date instead of a Timestamp).
Regards, Christof Jazz Work Item team |
![]()
I am using RTC version 3.0, and accessing JAVA api.
I am facing the following problem while trying to fetch the enumerations: Code snippet: IEnumeration<IPriority> enums = (IEnumeration<IPriority>)workItemClient.resolveEnumeration(attribute, null); Also, the same error occurs, while doing following operation: IWorkItemType workItemType = service.findWorkItemType(projectArea, "defect", new SysoutProgressMonitor()); Exception in thread "main" java.lang.IllegalArgumentException at com.ibm.team.process.internal.common.util.AbstractProcess.computeConfigurationData(AbstractProcess.java:328) at com.ibm.team.process.internal.common.util.AbstractProcess.getProjectConfigurationData(AbstractProcess.java:313) at com.ibm.team.process.internal.common.util.AbstractProcess.getProjectConfigurationData(AbstractProcess.java:299) at com.ibm.team.workitem.client.internal.AuditableClientProcess.findProcessConfiguration(AuditableClientProcess.java:68) at com.ibm.team.workitem.common.internal.EnumerationManager$InternalEnumerations.resolve(EnumerationManager.java:52) at com.ibm.team.workitem.common.internal.EnumerationManager.updateCache(EnumerationManager.java:198) at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:117) at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:74) at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:65) at com.ibm.team.workitem.common.internal.EnumerationManager.internalResolve(EnumerationManager.java:173) at com.ibm.team.workitem.common.internal.EnumerationManager.resolve(EnumerationManager.java:169) at com.ibm.team.workitem.common.internal.WorkItemCommon.resolveEnumeration(WorkItemCommon.java:453) at CreateWorkItem.main(CreateWorkItem.java:147) |
![]()
Hello Christof,
I recently went through this post while trying to search any article that explains on reporting out of the history details. This post seems something similar. I would like to start writing reports that can fetch the changes of a work item along with the state changes. Could you please if there is a way I can achieve this, if so how? Many Thanks, Regards, Sunita Thanks Christof! What you suggested worked great! |
![]() We would fetch the user id from the predecessor state of a work-item. We are using the code below: ITeamRepository repo = ... IWorkItem wi = ... IAuditable predecessorState = repo.itemManager().fetchCompleteState(wi.getPredecessorState(), null); IContributorHandle contributorH = predecessorState.getModifiedBy(); IContributor contributor = (IContributor) repo.itemManager().fetchCompleteItem(contributorH, IItemManager.DEFAULT, null); String userId = contributor.getUserId()); But the userId is coming from the last contributor who changed the work-item's state, not from the predeccessor... Any advice? Thanks in advance.
|
![]() can you share the snippet for the same so that it will helpful for others also. |