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

Defaulting String attributes to the current Users Name and Email address

In a users profile, a user has the userID, but also Name and Email address.

We have a custom work item that has two text fields:
Submitter Name
Submitter Email

We want to be able to default these values to the Name and Email from the logged-in user's profile.  So by default, they are set to whomever is creating the work item (logged in).  As the default, it would get put in initially but the logged-in user who is creating the work item could change it (scenario where I am typing in the work item by the real submitter is someone else).

Looking at DefaultValue providers, I can see that I can get the AuthenticatedUser, but it only allows me to get the entire Contributor, and I am not able to set that DefaultValue on my text fields (somewhat expected).

I then looked at a CalculatedValue, thinking I could calculate it *IF* they didn't enter something.  I am trying to keep from making them required and making someone type in their name when I should be able to get their name from the user profile (same with email).  I can do a Script-Based calculated value, but javascript APIs do not (I believe) give me access to the CurrentUser.  That requires Java APIs.  However, I can't find where I can link in a Java-based default value provider or a java-based CalculatedValue provider.

Can someone point me to this?

Susan




0 votes



One answer

Permanent link
See
https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ for how to use Java for providers.

You could use a default value provider to fill out the fields. Mixing a calculated value provider with manual input is actually problematic. It will always calculate when triggered. The only thing you can do is to pass the old value if there is one and pass a new value if there is no valid one. Usually attributes with calculated value providers should be set to read only in the UI, to avoid the user entering a value that gets eventually overwritten.

0 votes

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
× 10,939

Question asked: Jan 09 '14, 1:53 a.m.

Question was seen: 5,587 times

Last updated: Jan 09 '14, 3:12 a.m.

Confirmation Cancel Confirm