RTC: how to make mandatory the "Duplicate Of" link?

- when a work item is closed with the action Duplicate (and the resolution Duplicate), the Duplicated Of link must be mandatory, and the work item save must fail if such a link is not provided
Can this feature be re-activated?
Accepted answer

Comments

Luis, are you saying that I should change the state id of the "Closed" state to "r2"? (it currently "s5" in the bugzilla workflow I am using for Defects).
Also, is there any way to enable this behavior for the other workflows (so that I can enable it for Change Requests, Tasks, ...)?

I meant to say the resolution id. "r2" is the resolution id for state Closed - Duplicate.

It seems there is a previous check too, the workflowid must match the defect workflow id or "bugzillaWorkflow"

About enabling this in other item types, they would need the same workflowDefeinition id, so only "bugzillaWorkflow" or the same id of the defect type.
2 other answers

Comments

Hi there - can you share what that validator looks like? Script or ?

Our resolution for duplicate all end with ".duplicate" in our configuration, so the validator does this:
if (wi.getResolution2().getStringIdentifier().endsWith(".duplicate")) {
if (!hasDuplicateOfLink(saveParameter.getNewReferences())) {
IAdvisorInfo createProblemInfo = collector.createProblemInfo("DuplicateOf Link Required", "To mark the work item as Duplicate, you must have a DuplicateOf link.","error");
collector.addInfo(createProblemInfo);
return;
}
return;
}
And the hasDuplicateOfLink method is:
private boolean hasDuplicateOfLink(IWorkItemReferences references) throws TeamRepositoryException {
List<IReference> duplicateOfLinks = references.getReferences(WorkItemEndPoints.DUPLICATE_OF_WORK_ITEM);
if (duplicateOfLinks == null) return false;
if (duplicateOfLinks.size() < 1) return false;
return true;
}
1 vote

I opened enhancement 242467 to move this function to an external function
Comments

Sam, are you saying that this behavior is "inherent" to a workitem type?
So, I wonder how it could suddenly "disappear" from that workitem type.
According to this enhancement request https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=237971 , it is hard-coded in these workflows: EclipseWayWorkflow.ID and InternalWorkflowKeys.DEFECT_WORKFLOW_ID.
Anyway, I have a project area where Defects, which use the Default Workflow (id: bugzillaWorkflow) have this desired behavior on Duplicate.
In another project area (on a different RTC server, but with the same RTC version), Defects using the same workflow do not have this behavior.