Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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

1 vote


Accepted answer

Permanent link
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

0 votes


5 other answers

Permanent link
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.


 

1 vote


Permanent link
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

1 vote

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.



Permanent link
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

0 votes

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


Permanent link
It worked ! Thanks for the tip, it is exactly what I wanted to know.

0 votes


Permanent link

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


Thanks.

0 votes

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.

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 32
× 24

Question asked: Nov 08 '12, 10:34 a.m.

Question was seen: 7,951 times

Last updated: Feb 15 '21, 4:44 a.m.

Confirmation Cancel Confirm