WI attribute customization: default subscribers list with javascript
Milan Krivic (980●13●176●143)
| asked Jul 23 '14, 7:35 a.m.
edited Jul 23 '14, 7:42 a.m. by Ralph Schoon (63.6k●3●36●47)
Hi,
I want to add a default subscribers list on specific work item based on chosen work item category.
This is my JavaScript code:
dojo.provide("com.apisit.users.list");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.apisit.users.list", null, {
getValueSet: function(attribute, workItem, configuration) {
var wi_type = workItem.getValue(WorkItemAttributes.TYPE);
var wi_category = workItem.getValue(WorkItemAttributes.FILED_AGAINST);
var DefaultSubscribers = [];
DefaultSubscribers.push("_thFDcGJzEd-408oU3hXeOA");
DefaultSubscribers.push("_i0ozwDgrEeC-ZOxsQ_2mZQ");
DefaultSubscribers.push("_q13YBAzMEd-3T9F8SUEaUw");
if(wi_type=="bug" && wi_category == "_X-ruUA0hEeKkzKqDw-rhOA")
{
return DefaultSubscribers;
}
}
});
})();
But this doesn't work :(
I know that I can make UsersList, but I can't do it for specific wi category and wi type except in this way I think...
What am I doing wrong?
|
Accepted answer
Ralph Schoon (63.6k●3●36●47)
| answered Jul 23 '14, 7:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Milan,
this will not work and you can't get it to work with JavaScript. As described in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript there is only limited support. You can effectively access attributes of the work item the JavaScript runs. You can not access other data such as attachments, work item links, team areas and a lot more. Since these questions come up over and over again, we tried to put some information onto https://jazz.net/library/article/1093 (Lab 5 the beginning). https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ might be a valid approach. Milan Krivic selected this answer as the correct answer
Comments
Milan Krivic
commented Jul 23 '14, 7:56 a.m.
Hi Ralph,
I supposed this will be the answer.
The problem is that we have master project area which shares its process template to all other project areas, and that's the reason I wanted to do this with JavaScript Calculated Values.
I'll try something with java.
Thanks,
Milan
Good luck Milan. Java Provider have to be deployed in the client and the server. Another approach could be a save work item participant. My blog talks about the API and some examples here: https://rsjazz.wordpress.com/2012/08/02/subscribing-to-a-work-item-using-the-java-api/ I think it is client API, but client and server API are very similar here.
|
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.