How to copy ID to a custom attribute autommatically if it is empty
![]()
Hello, I want to copy ID to a custom attribute automatically if it is empty.
How can I achieve the above? |
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;
}
});
})();
Masahiro Mizogami selected this answer as the correct answer
|
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.