It's all about the answers!

Ask a question

Attribute Customizations - Calculated Value - How do I extract a name from the UUID for Creator


David Murphy (11143) | asked Apr 10 '13, 5:33 p.m.
edited Apr 11 '13, 1:08 a.m. by Ralph Schoon (61.8k33643)
I want to assign the name of the work item's creator to a custom field.  I can figure out how to extract the UUID for the Creator field, but don't know how to fetch the name in the form of a string for my calculated value script from the UUID.

2 answers



permanent link
sam detweiler (12.5k6189201) | answered Apr 10 '13, 11:43 p.m.
currently there is no mechanism to get from UUID to contributor name in Javascript

see https://jazz.net/forum/questions/80964/how-to-get-contributor-name-by-javascript
you would have to write a java participant server plugin

permanent link
Ralph Schoon (61.8k33643) | answered Apr 11 '13, 1:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 Try workItem.getLabel().

Comments
sam detweiler commented Apr 11 '13, 7:52 a.m.

getlabel() on what? the UUID or the contributor entry?


Ralph Schoon commented Apr 11 '13, 8:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

instead of

var uuid= workItem.getValue( WorkItemAttributes.OWNER );

try using

var name_or_id = workItem.getLabel( WorkItemAttributes.OWNER );

I am not sure if it returns the readable user ID or the user name though.


David Murphy commented Apr 11 '13, 11:21 a.m.

Cannot find function getLabel in object [object com.ibm.team.workitem.shared.common.internal.scripting.facades.WorkItemAPIType].

my js statement:  workItem.getLabel(WorkItemAttributes.CREATOR)


Ralph Schoon commented Apr 11 '13, 11:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I used it in https://jazz.net/library/article/1093 Lab 5 and it works for me. It might have been introduced in 4.0.


David Murphy commented Apr 12 '13, 11:59 a.m.

I am using your js and I am erroring out on this statement,

                out+="Creator Name: " + workItem.getLabel(WorkItemAttributes.CREATOR)+"\n";

Tried this with RTC 4.0.1


Ralph Schoon commented Apr 12 '13, 12:06 p.m. | edited Apr 13 '13, 8:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am using my lab 5 solution files from https://jazz.net/library/article/1093 (calculated against the description) and it works for me in 4.0.1. It actually provides the name and not the ID.




David Murphy commented Apr 12 '13, 4:57 p.m.

works fine when you use the right client, duh, thanks

showing 5 of 7 show 2 more comments

Your answer


Register or to post your answer.