Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:

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

0 votes



4 answers

Permanent link
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

1 vote

Comments

heh, that last sentence "Also make sure...." just saved my day :-D


Permanent link
Can someone please help me here? Thanks in advance!!

0 votes


Permanent link
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

0 votes

Comments

moved this comment


Permanent link
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

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Sep 06 '11, 10:48 a.m.

Question was seen: 6,801 times

Last updated: Nov 23 '12, 5:29 a.m.

Confirmation Cancel Confirm