Owned By: on change validation -> change "Owned By" value
So I can't seem to change "Owned By" value after it's validated. Previously I was using a validator but I changed to Calculated Value to be able to change the value of the "Owned By".
In the validator, it ran fine, however the value was not changed of course, now that I have changed to calculated value it doesn't even run onto the validation.
What am I doing wrong?
edit: if the custom attribute "elvis" value is found or matches a value in the "Owned By" list, nothing happens but if it's not found then "Owned By" value should change to Unassigned.
// ----- CODE ------
dojo.provide("org.example.calculated.ValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("org.example.calculated.ValueProvider", null, {
getValue: function(attribute, workItem, configuration) {
var ownedByList = workItem._proxy._priorFetchEditablePropertiesEditProps.allValues[7].uiItems;
var elvisUserID = workItem._proxy.object.attributes.Elvis_UserID.content;
var elvisFound = false;
for (i = 0; i < ownedByList.length; i++) {
if(ownedByList[i].label.toLowerCase() == elvisUserID.toLowerCase()) {
elvisFound = true;
}
}
if(elvisFound) {
//Found Elvis User ID in Owned By List & continue
alert('Elvis User ID found.');
return; //nothing happens
} else {
//Elvis User ID not found in Owned By List then change value to unassigned.
alert('elvis user id not found in owned list');
return; //change "Owned By" value to Unassigned
}
}
});
})();
thanks! take a look at the returns
|
2 answers
I don't really know what you try to do, particularly with a flawed logic.
|
Thanks for the reply! I managed to do it by returning the ID, I was trying other way but it works now, thanks though! |
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.