script-based customization getValue returns null (Newbie question)
Can't seem to use getValue() or WorkItemAttributes. How do I get these loaded? Is there a configuration someplace to point to these resources?
*****************************************************************************************
This first one works:
******************************************************************************************
dojo.provide("com.example.ValueProvider.basedonstate");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
(function() {
dojo.declare("com.example.ValueProvider.basedonstate", null, {
getValue: function(attributeId, workItem, configuration) {
var currentDate= new Date();
var Datestring= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
return "Date " + Datestring ;
}
});
})();
*********************************************************************************************
This Does not:
*********************************************************************************************
dojo.provide("com.example.ValueProvider.basedonstate");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
(function() {
dojo.declare("com.example.ValueProvider.basedonstate", null, {
getValue: function(attributeId, workItem, configuration) {
var typeString = + workItem.getValue(WorkItemAttributes.TYPE);
return "Type: " + typeString ;
}
});
})();
2 answers
here is one of my condition scripts
<code>
dojo.provide("com.xx.defect.resolution.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.xx.defect.resolution.Condition", null, {
matches: function(workItem, configuration)
{
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var rc = false;
var workitemtype = workItem.getValue(WorkItemAttributes.TYPE);
console.log(workitemtype);
if( workitemtype ==="defect" )
{
var state= workItem.getValue(WorkItemAttributes.STATE);
console.log(state);
if(state === "3" )
{
var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION);
console.log(resolution);
if(resolution === "3" )
{
var classification = workItem.getValue("com.xx.fribblelist");
console.log(typeof(classification))
if(classification === "" )
{
/*return (state === "3" || state === "4"); // Resolved or Verified stat
rc= true;
}
rc = true;
}
}
}
return rc;
}
});
})();
</code>
<code>
dojo.provide("com.xx.defect.resolution.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.xx.defect.resolution.Condition", null, {
matches: function(workItem, configuration)
{
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var rc = false;
var workitemtype = workItem.getValue(WorkItemAttributes.TYPE);
console.log(workitemtype);
if( workitemtype ==="defect" )
{
var state= workItem.getValue(WorkItemAttributes.STATE);
console.log(state);
if(state === "3" )
{
var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION);
console.log(resolution);
if(resolution === "3" )
{
var classification = workItem.getValue("com.xx.fribblelist");
console.log(typeof(classification))
if(classification === "" )
{
/*return (state === "3" || state === "4"); // Resolved or Verified stat
rc= true;
}
rc = true;
}
}
}
return rc;
}
});
})();
</code>