Set Contributer Type using script
Hello Team,
I am using RTC 6.0.2
I want to set Contributer Attribute with a particular user name on save of WI.
I want to do it using dojo Script, Please help me.
My code is below:
dojo.provide("com.example.IssueFLValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.example.IssueFLValueProvider", null, {
getValue: function(attribute, workItem, configuration) {
var subSystem = '';
var FL = [];
subSystem = workItem.getLabel("com.ibm.team.workitem.attribute.SuspectedAreaList");
if(subSystem == "XXX")
{
FL.push("Pankaj Sharma");
}
try
{
return FL;
}
catch
{
console.log(err.message);
}
}
});
})();
Accepted answer
https://jazz.net/wiki/bin/view/Main/AttributeCustomization mentions
Only values of the following attribute types can be safely read by and returned from scripts: .......
- Limited support for Items
Currently there is no dedicated API to work with Items or Enumerations and scripts can only use the id of such attributes. If you need additional information, such as the name that corresponds to an Enumeration literal id, you can pass it to scripts using configuration parameters. See the Configuring additional script parameters section for more information.
One other answer
If you want to set a value to an attribute when saving a work item, you should use a Calculated Value provider. You script shown above is a Value Set provider, which provides a set of values for a certain attribute. I suggest you read through the below article and wiki to have better understanding the attribute customization topic.
https://jazz.net/library/article/1003
https://jazz.net/wiki/bin/view/Main/AttributeCustomization
https://jazz.net/library/article/1003
https://jazz.net/wiki/bin/view/Main/AttributeCustomization