IIterationTypeHandle is null ???
![](http://jazz.net/_images/myphoto/61fe9ae3e2ca3fe9b02154d98ed61451.jpg)
Hey Everyone,
We are trying to make a custom precondition to prevent saving certain workitem types on certain iteration types.
Now we run into the problem that even though our Iteration found on the workitem for sure has a defined iteration type the IiterationTypeHandle returned is null.
Our code:
anIterationTypeHandle is always null anyone knows why ?
We are trying to make a custom precondition to prevent saving certain workitem types on certain iteration types.
Now we run into the problem that even though our Iteration found on the workitem for sure has a defined iteration type the IiterationTypeHandle returned is null.
Our code:
if (auditable instanceof IWorkItem)
{
IWorkItem aWorkItem = (IWorkItem) auditable;
String workitemtype = aWorkItem.getWorkItemType();
if ( aWorkItem.getTarget()!=null)
{
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();
anIterationTypeHandle is always null anyone knows why ?
One answer
![](http://jazz.net/_images/myphoto/61fe9ae3e2ca3fe9b02154d98ed61451.jpg)
Hey Everyone,
We are trying to make a custom precondition to prevent saving certain workitem types on certain iteration types.
Now we run into the problem that even though our Iteration found on the workitem for sure has a defined iteration type the IiterationTypeHandle returned is null.
Our code:
if (auditable instanceof IWorkItem)
{
IWorkItem aWorkItem = (IWorkItem) auditable;
String workitemtype = aWorkItem.getWorkItemType();
if ( aWorkItem.getTarget()!=null)
{
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();
anIterationTypeHandle is always null anyone knows why ?
We found the solution using the full item profile:
if (auditable instanceof IWorkItem)
{
IWorkItem aWorkItem = (IWorkItem) auditable;
String workitemtype = aWorkItem.getWorkItemType();
if ( aWorkItem.getTarget()!=null)
{
//IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.createFullProfile(aWorkItem.getTarget().getItemType()), monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();