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

Attribute Customization Scripted Based Default Values

I'm receiving an error when I use the sample code provided with the Script Based Values option under the Default Values section of attribute customization. The sample code below throws "Error invoking default value provider 'com.ibm.team.workitem.valueproviders.DEFAULT_VALUE_PROVIDER._8IEaEPwvEeCQiOpI0UXknQ'"
It will return text fine however (shown remarked out below). Advice?

/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2011. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
dojo.provide("com.example.DefaultValueProvider");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

return workItem.getValue(attribute);
//return("test");

}
});
})();

0 votes



8 answers

Permanent link
Use Firebug, put a breakpoint in the javascript, does it reach it ?
I will try it on my side

0 votes


Permanent link
RTC 3.0.1
Created new Project Area
Created new Default Value - Script
Added return('test'); ,<-- notice ' not "
creates a SmallString attribute
Added default value to it
Works for me in Eclipse and Web clients

Can you confirm ?

0 votes


Permanent link
Hi,

this is still experimental and needs to be switched on in the CCM server administration or in the teamserver.properties using

com.ibm.team.workitem.process.scripts.enabled=true

I forgot and the logs show issues loading the script and a similar error after that.

0 votes


Permanent link
Hi,

this is still experimental and needs to be switched on in the CCM server administration or in the teamserver.properties using

com.ibm.team.workitem.process.scripts.enabled=true

I forgot and the logs show issues loading the script and a similar error after that.

Hi Ralph,
It is enabled, I just checked the teamserver.properties file.
Thanks.
Derry.

0 votes


Permanent link
RTC 3.0.1
Created new Project Area
Created new Default Value - Script
Added return('test'); ,<-- notice ' not "
creates a SmallString attribute
Added default value to it
Works for me in Eclipse and Web clients

Can you confirm ?


Yes that works.

This does not work --> return workItem.getValue(attribute);

-Derry

0 votes


Permanent link
try this...
the state may not exactly be what you need, but that should get you started

******
dojo.provide("com.example.DefaultValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var status = workItem.getValue(WorkItemAttributes.STATE);
var TestString = "";
if ((status === "s1")) { // Initialize
TestString = 'Active';
} else {
TestString = 'Done';
}
return TestString;

}
});
})();

0 votes


Permanent link
Christophe,

I tested the new script, the following line
var status = workItem.getValue(WorkItemAttributes.STATE);
, does not seem to do anything. status is always NULL. Therefore, the code will always return "Active_Iteration".

Here is my modified test code, which will give me "NULL" all the time:
dojo.provide("com.example.DefaultValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var status = workItem.getValue(WorkItemAttributes.STATE);
var TestString = "";
if (status) {
if ((status === "s1")) { // Initialize
TestString = 'Done_Iteration';
} else {
TestString = 'Active_Iteration';
}} else {TestString = 'NULL';}
return TestString;
//return status;
}
});
})();

0 votes


Permanent link
Derry,

The following code should work, and will return something meaningful:
dojo.provide("com.example.DefaultValueProvider");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {
var TestString = "";
TestString = dojo.toJson(attribute);
return TestString;
}
});
})();

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,927

Question asked: Oct 26 '11, 4:46 p.m.

Question was seen: 5,465 times

Last updated: Oct 26 '11, 4:46 p.m.

Confirmation Cancel Confirm