How to automatically assign categories (filed_against attribute) to work item ?
I am new to RTC (3.0.1.1) and I am currently trying to build a new Project Area.
In this project area we have two team areas and one work item category for each team area.
Categories are listed as follows
Unassigned <Root Category>
L London
L Paris
London is associated with London Team area and Paris is associated with ParisTeam area.
When I create a new work item, depending on the user and the team area he belongs to, I would like to have the work item filed against the right category.
However it is always filed under "Unassigned" which is the top level category (associated with the Projet Area).
Is there a way to avoid that ?
Thank you very much
Accepted answer
This is a "Validator" script.
You need to assign it to the attribute you want the retrieve the UUID and you will get the info in the "Error Log" view.
Tell me if that helped :)
And good luck
Script :
dojo.provide("Validator.Util");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("Validator.Util", null, {
validate: function(attribute, workItem, configuration) {
console.log("ATTRIBUTE : " + attribute);
var value = workItem.getValue(attribute);
console.log("VALUE : " + value);
return Status.OK_STATUS;
}
});
})();
5 other answers
There are capabilities in Java Script based customizations, however, they are very limited and I think you would have to hard code a mapping of user ID's to the category ID's if you want to use that.
The other way I can think of is a follow up action that could do this task. See https://jazz.net/library/article/1000 on how to get started.
As the teams are only made of 4 or 5 people, I decided to write a Script based customization.
The script was quite easy to write and it seems that the other solution you were offering is only suitable for RTC 4.0 (I am using RTC 3.0.1.1)
Thank you
Comments
Hello Gilles, Can you please explain here how you refer to Category values in your script. I try to find the information, but do not find any example. (for instance, in my script, I want to return the value of the category "Development"). Thanks for the information !
Jean-Michel, I would assume he was using
WorkItemAttributes.FILED_AGAINST
See: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of
In 4.x you can getValue() to get the value to return and getLabel() to get the displayname. Please keep in mind, that you have to know the right category value to return in a script (e.g. from looking at logs), there is no API to iterate the categories available in JavaScript. There is also no API in JavaScript to iterate existing users etc.
Could you please provide with an extract of your code ?
Basically what I did :
- I mapped each user with his UUID (I retrieved this UUID with a small script I can send you if you want)
- I mapped each user with his Category's UUID (retrieved the same way as previously) and then I set the "Filed against" attribute with this UUID.
This was not very hard in my case because there aren't a lot of users so the mapping was easy.
You might want to do something like this :
ojo.provide("SED.ValueProvider.Filed_Against");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("SED.ValueProvider.Filed_Against", null, {
getValue: function(attribute, workItem, configuration) {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var userUUID = workItem.getValue(WorkItemAttributes.CREATOR);
var Gilles_TrautmannUUID = "_FfmcsOsbEeGD1r7xkMLeGw"; // Retrieved via another script
var ParisUUID = "_fgW3gCjiEeKOcJXMBz1GaA";
var LondonUUID = "_61ClUh9NEeKJDq__QfUm3A";
switch (userUUID)
{
case Gilles_TrautmannUUID:
//console.log("Gilles");
return LondonUUID;
case else:
return ParisUUID;
}
}
});
})();
The UUID thing was mandatory (I assume in RTC 3.0.1.1) but I think that now you can directly retrieve the value (i.e the "displayed" value, in my case Gilles Trautmann instead of _FfmcsOsbEeGD1r7xkMLeGw).
However this needs to be confirmed
Hope this helps
Comments
Great ! Yes I'm interested by the way you get the UUIDs. Thanks again.
HI!!!
I have the same problem to solve....retrive the UUIDs of Category:-) I'm very interested by the script you use to get UUIDs. It is possibile to have an example? Many thanks in advance!! Marina
See the AttributeValueAnalyzer in Lab 4 of the Process Enactment Workshop
Comments
Why one would answer with a question to a 7 year old question, is beyond me. How to get the UUID's for filed against (deliverable) objects is totally dependent of the context you work in. If you create your own question for this or hint on an unanswered question for this. I would be willing to answer there.