It's all about the answers!

Ask a question

How to add predecessor programmaticaly?


glory pugazhenthi (5699) | asked Apr 16 '12, 1:28 a.m.
Hi,

I have followed the below link to create new work item using plain java client library.

https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation


Let me know how to add predecessors to the work item.



Thanks,

Pugazh

One answer



permanent link
glory pugazhenthi (5699) | answered Apr 16 '12, 3:15 a.m.
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);

}

Your answer


Register or to post your answer.