work item type is same on different work items
I am using RTC 5.0
I want to access the work item type for respective work item using javascript.
I have a requirement to display data based on workitem type, I used the following script
dojo.provide("com.example.ValueProvider_projectautopopulate1234");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.example.ValueProvider_projectautopopulate1234", null, {
getValue: function(attribute, workItem, configuration) {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var Wtype = workItem.getLabel(WorkItemAttributes.TYPE);
var attr4_value = '';
if(Wtype = 'Release')
{
attr4_value = 'yes';
}
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.example.ValueProvider_projectautopopulate1234", null, {
getValue: function(attribute, workItem, configuration) {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var Wtype = workItem.getLabel(WorkItemAttributes.TYPE);
var attr4_value = '';
if(Wtype = 'Release')
{
attr4_value = 'yes';
}
else
{
attr4_value = 'no';
}
return attr4_value;
}
});
})();
return attr4_value;
}
});
})();
But i am getting workitem type as 'Release' even if I am on different workitem, Please help
2 answers
i would suggest you look at some of the blogs about the RTC plain java client API such as https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
and on our jazz.net library such as https://jazz.net/library/article/1229
and on our jazz.net library such as https://jazz.net/library/article/1229
Please do this workshop:
Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management
Lab 5 is around JavaScript. Most likely your code is basically wrong and because JavaScript and the editor in RTC is so underwhelming in helping developers you need to do the work a compiler and debugger would do for you otherwise.
Tips: Try "StateID" and ==, carefully read https://jazz.net/wiki/bin/view/Main/AttributeCustomization and get some basics in JavaScript here http://www.w3schools.com/js/ . Use Console.log() to print the values and use this to debug your script: Debugging attribute customization scripts - an example
Lab 5 is around JavaScript. Most likely your code is basically wrong and because JavaScript and the editor in RTC is so underwhelming in helping developers you need to do the work a compiler and debugger would do for you otherwise.
Tips: Try "StateID" and ==, carefully read https://jazz.net/wiki/bin/view/Main/AttributeCustomization and get some basics in JavaScript here http://www.w3schools.com/js/ . Use Console.log() to print the values and use this to debug your script: Debugging attribute customization scripts - an example