Attribute Customization:CalculatedValue of custom attribute
Hi all,
I am trying to create an Attribute Customization for Calculated Value of a custom variable.
The scenario for the attribute customization is as follows: I want to read the string form a custom attribute 'A' of a text box and update another custom attribute 'B' (a multi line text box) with the text taken from attribute 'A'.
Please advise how is this possible? I am stuck at this point. Thanks in advance!!
The script I wrote is as follows:
I added two custom attributes 'test_string' and 'test _string01' to the Task WI. I basically want to read the contents of 'test_string' and apply the same as appended value to 'test string 01'. I created a script as below:
Regards
Vinay
I am trying to create an Attribute Customization for Calculated Value of a custom variable.
The scenario for the attribute customization is as follows: I want to read the string form a custom attribute 'A' of a text box and update another custom attribute 'B' (a multi line text box) with the text taken from attribute 'A'.
Please advise how is this possible? I am stuck at this point. Thanks in advance!!
The script I wrote is as follows:
I added two custom attributes 'test_string' and 'test _string01' to the Task WI. I basically want to read the contents of 'test_string' and apply the same as appended value to 'test string 01'. I created a script as below:
dojo.provide("org.example.workitems.providers.CalculatedValueString");
(function() {
dojo.declare("org.example.workitems.providers.CalculatedValueString", null, {
getValue: function(attributeId, workItem, configuration) {
var test_stringAttribute= configuration.getChild("test_string").getIdentifier();
var test_string=workItem.getValue(test_stringAttribute);
return test_string;
}
});
})();
Regards
Vinay
4 answers
Can someone please help me here? Thanks in advance!!
Hi Vinay,
This should work for you.
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("net.example.calculatedValueString", null, {
getValue: function(attribute, workItem, configuration) {
var test_stringAttribute = workItem.getValue("com.ibm.team.workitem.attribute.test_string"); // Note: This is the attribute ID and not the name
var test_string = test_stringAttribute;
return test_string;
}
});
})();
Also make sure you have added test_string in the dependencies list of attribute test_string01
-- Indradri
I have a similar problem. I would like to assign the value of a custom "contributor" attribute to the "Owner". I tried using workItem.getValue("com.ibm.team.workitem.attribute.test_string") to get the value of the custom attribute. But it always returns null. Any ideas?
Cheers,
Alan
Cheers,
Alan
Hi Vinay,
This should work for you.
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("net.example.calculatedValueString", null, {
getValue: function(attribute, workItem, configuration) {
var test_stringAttribute = workItem.getValue("com.ibm.team.workitem.attribute.test_string"); // Note: This is the attribute ID and not the name
var test_string = test_stringAttribute;
return test_string;
}
});
})();
Also make sure you have added test_string in the dependencies list of attribute test_string01
-- Indradri
I have a similar problem. I would like to assign the value of a custom "contributor" attribute to the "Owner". I tried using workItem.getValue("com.ibm.team.workitem.attribute.test_string") to get the value of the custom attribute. But it always returns null. Any ideas?
Cheers,
Alan
Hi Vinay,
This should work for you.
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("net.example.calculatedValueString", null, {
getValue: function(attribute, workItem, configuration) {
var test_stringAttribute = workItem.getValue("com.ibm.team.workitem.attribute.test_string"); // Note: This is the attribute ID and not the name
var test_string = test_stringAttribute;
return test_string;
}
});
})();
Also make sure you have added test_string in the dependencies list of attribute test_string01
-- Indradri
I would probably suspect if you have passed the correct id of your custom attribute in the getValue() and also if you have listed the owner attribute in the dependencies list of the custom attribute.
-- Indradri