How do I use the email address from a role in an RTC field?
RTC version = 4.0.2 I have a field called Requestor, type of Contributor, and it uses the "Client User" role as it's value set. I have a drop-down field on the page called Requestor and would like to display the email address associated with the user selected from the list. Is there a way to reference that and if so, how is it done?
|
One answer
Ralph Schoon (63.5k●3●36●46)
| answered Sep 30 '13, 7:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Since you can't access more than the name an UID in attributes of type contributor (see See https://jazz.net/library/article/1093 Lab 5 for the limitations of JavaScript and what you can do. ) using JavaScript. Java Script based attribute customization is out of the picture.
You could try to create a java based calculated value for this kind of requirement. http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ shows some examples that you could start with. If you can get the contributor from an attribute or the work item, you could use the IContributor.getEmailAddress() API to access and return that data. Comments
Ryan McBryde
commented Sep 30 '13, 2:53 p.m.
Thanks all for the information. I am looking, as Maddie described it. "To show the email address in some other field (sort of as a display-only field for the user's reference)". I have a field (attribute) called Client User, which is an attribute of type "Contributor". It gets it's value set from the Client User role user list in the Project Area. So when I click on the Client User field I get a drop-down list of all the users in the project who have been given the Client User. After I select one of the users from that list I would like to display that users email address (which was defined when the user was created in the JTS) in a readonly field on the page. If I am following the discussion up to this point correctly, Ralph is saying that there might be a way to create a java based calculated value based on the 'contributor' selected. Am I understanding that right? I will take a look at the examples in the link provided and see if I can make it work. Thanks, Ryan Yes, as Ralph describes, you should be able to do this via the Java API. If this will be your first server-side contribution, take some time to read some of Ralph's other articles on this topic -- it will likely save you some time in the long run.
Ryan McBryde
commented Sep 30 '13, 4:58 p.m.
Thanks Millard, You guessed it. Thanks for the tip. I will need to dig deep. I would suggest to start with https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ and the related articles. It should get you over the hump.
|
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.
Comments
Display how? Do you want to show the email instead of the user name in the drop down? Or do you want to show the email address in some other field (sort of as a display-only field for the user's reference)? Depending on how you define "is there a way", the answer is probably yes, but may involve writing a server-side Java contribution to provide the new behavior. Depending on what you ultimately want to do, you might be able to use a Calculated Value JavaScript customization (though I haven't tried this -- I'm not positive you can extract the email address this way, e.g., if it ultimately comes from an external LDAP server.
Millard, could you share your Calculated Value JavaScript customization for reference?Thanks!
JavaScript won't allow to do this as discussed many times already. See https://jazz.net/library/article/1093 Lab 5 for the limitations of JavaScript.
@Jia Jia Li I don't have a particular script that does this. I was referring to the Calculated Value customization capability in general, though as Ralph points out, the values you want are not available that way (thanks, Ralph!).