How to copy ID to a custom attribute autommatically if it is empty
Accepted answer
Hi Mizogami-san,
I think it can be done with using a script based attribute customization like below. When you create a new workitem, I would assume the custom attribute should be -1 or 0 so that the script returns ID. If it is not empty, it simply returns the original value of the attribute. Hoping it would help you. Thank you.
/* sample */
dojo.provide("com.example.ValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.ValueProvider", null, {
getValue: function(attribute, workItem, configuration) {
var value = parseInt(workItem.getValue(attribute));
if (value < 1){
value = workItem.getValue(WorkItemAttributes.ID);
}
return value;
}
});
})();