Scripting to set owned by attribute
I am trying to write a script that sets the owned by attribute for work items. From looking at resources online, I understand that you have to get the GUID for the members and use this string to set the owned by attribute. Using the examples online I have gotten it to work when the GUID is a parameter in the Process Configuration Source XML.
So for example, this code works:
dojo.provide("org.example.SetECMOwner");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var SetECMOwner= dojo.declare("org.example.SetECMOwner", null, {
getValue: function(attributeId, workItem, configuration) {
return configuration.getChild("parameters").getStringDefault("owner", "");
}
});
})();
However, I can't get the logic to work when the GUID is a variable in the script itself. Looking for hints on how to possible make this work. Here is what does not work:
dojo.provide("org.example.SetECMOwner");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var SetECMOwner= dojo.declare("org.example.SetECMOwner", null, {
var userID = new String("_lKtTgCuwEeGpYa9eAF1pPA");
return userID;
}
});
})();
So for example, this code works:
dojo.provide("org.example.SetECMOwner");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var SetECMOwner= dojo.declare("org.example.SetECMOwner", null, {
getValue: function(attributeId, workItem, configuration) {
return configuration.getChild("parameters").getStringDefault("owner", "");
}
});
})();
However, I can't get the logic to work when the GUID is a variable in the script itself. Looking for hints on how to possible make this work. Here is what does not work:
dojo.provide("org.example.SetECMOwner");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var SetECMOwner= dojo.declare("org.example.SetECMOwner", null, {
var userID = new String("_lKtTgCuwEeGpYa9eAF1pPA");
return userID;
}
});
})();