It's all about the answers!

Ask a question

Obtain a task the first predecessor (Participants plugin)


Javier López (1134) | asked Sep 12 '12, 6:06 a.m.

I explained i have (sorry my english is bad):

I want to get the task A "IWorkItemHandle" when you save a value of task C

   Task A (succesor Task B)

          ---> Task B (predecesor Task A, succesor task C)

                       ---->  Task C (predecesor Task B)

My code is (Participant plugin):

  ISaveParameter saveParameter = (ISaveParameter) data;
List<IReferences> references=saveParameter.getNewReferences().getReferences(WorkItemEndPoints.PREDECESSOR_WORK_ITEMS) ;

if (references.isEmpty()) {
   return null;
  }

  for (IReference reference : references) {
   if (reference.isItemReference()) {
    Object obj = reference.resolve();
      if (obj instanceof IWorkItemHandle) {
          System.out.println("6 -->" + reference.getLink().getOtherRef(reference));
         return (IWorkItemHandle) obj;
    } // end if
   } // end if
  }// end for

One answer



permanent link
sam detweiler (12.5k6195201) | answered Sep 13 '12, 6:57 a.m.
once you have B in your code, you need to repeat the same operations using B as the current workitem to get its parent.

Your answer


Register or to post your answer.