It's all about the answers!

Ask a question

IBM RTC 6.0.2 Is there any way to enforce a link type to make it mandatory?

Rafael Rodriguez Montes (23013126247) | asked Nov 30 '16, 2:09 p.m.
I would like to have a work item type to be enforced to have a link during the promotion of the work flow, I didn't notice any parameter easy to configure in enclipse is there any scripted way to do it?
I want to make mandatory or require a link type when the user attempt to promote the WI  to the next state, I don't see how to handle the behavior of the links types. 

2 answers

permanent link
Donald Nong (14.5k414) | answered Nov 30 '16, 11:05 p.m.
It's has been asked quite a few times before. You need to write a server side extension for it.

permanent link
Luca Martinucci (1.0k294112) | answered Dec 01 '16, 5:44 a.m.
I had  the same need, and I had to develop a custom java extension (a participant) to enforce this behaviour.
I hope that these code snippets help you:

// get list of links of the work item
Object data = operation.getOperationData();
ISaveParameter saveParameter = null;
if (data instanceof ISaveParameter) {
    saveParameter = (ISaveParameter) data;
IWorkItemReferences refs = saveParameter.getNewReferences();
// check if the "parent" link is present
IEndPointDescriptor mandatoryLinkDesc = WorkItemEndPoints.PARENT_WORK_ITEM;
// get list of links of the work item
List<IReference> listReferences = refs.getReferences(mandatoryLinkDesc);        
if ((listReferences!=null) && (!listReferences.isEmpty())) {
    // mandatory link present
} else {
    // mandatory link not present
    // TODO
    // return an error

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.