How to add predecessor programmaticaly?
One answer
find the solution below.
/***************** set predecessors *****************************/
if(fpredecessors>0)
setPredecessors(workingCopy,cawobj.fetchWorkItemsByID(fpredecessors));
private void setPredecessors(WorkItemWorkingCopy wc, IWorkItem parent) {
IEndPointDescriptor referenceType= WorkItemEndPoints.PREDECESSOR_WORK_ITEMS;
IReference reference= WorkItemLinkTypes.createWorkItemReference(parent);
wc.getReferences().add(referenceType, reference);
}
/***************** set predecessors *****************************/
if(fpredecessors>0)
setPredecessors(workingCopy,cawobj.fetchWorkItemsByID(fpredecessors));
private void setPredecessors(WorkItemWorkingCopy wc, IWorkItem parent) {
IEndPointDescriptor referenceType= WorkItemEndPoints.PREDECESSOR_WORK_ITEMS;
IReference reference= WorkItemLinkTypes.createWorkItemReference(parent);
wc.getReferences().add(referenceType, reference);
}