It's all about the answers!

Ask a question

How to automatically assign categories (filed_against attribute) to work item ?


Gilles Trautmann (3634) | asked Nov 08 '12, 10:34 a.m.
retagged Nov 08 '12, 8:00 p.m. by Millard Ellingsworth (2.5k12431)
Hi all,

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


permanent link
Gilles Trautmann (3634) | answered Jan 15 '13, 10:07 a.m.
Here it is.

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;
        }
    });
})();



Ralph Schoon selected this answer as the correct answer

5 other answers



permanent link
Ralph Schoon (59.0k23642) | answered Nov 09 '12, 8:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As far as I can tell, there is no such automation available. You can create an attribute customization that sets a general default category that you can choose. But there is no automated way that ties the work items category to the owner.

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.


 


permanent link
Gilles Trautmann (3634) | answered Nov 15 '12, 7:56 a.m.
Thank you for your answer Ralph.

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
Jean-Michel Athane commented Jan 15 '13, 7:14 a.m.

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 !


Ralph Schoon commented Jan 15 '13, 7:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.



permanent link
Gilles Trautmann (3634) | answered Jan 15 '13, 8:05 a.m.
Hi Jean-Michel,

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
Jean-Michel Athane commented Jan 15 '13, 9:28 a.m.

Great ! Yes I'm interested by the way you get the UUIDs. Thanks again.


marina delunas commented Jul 24 '13, 4:13 a.m.

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


Ralph Schoon commented Jul 24 '13, 5:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

See the AttributeValueAnalyzer in Lab 4 of the Process Enactment Workshop


permanent link
Jean-Michel Athane (671112) | answered Jan 15 '13, 11:22 a.m.
It worked ! Thanks for the tip, it is exactly what I wanted to know.

permanent link
Vikas Kumar (111) | answered Feb 10, 10:48 p.m.

 @Jean-Michel Athane, how did you get the UUID of "Filed Against" values?


Thanks.


Comments
Ralph Schoon commented Feb 11, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.