It's all about the answers!

Ask a question

How can I get the current user's name using Javascript within a calculated value in RTC that works in both the web UI and Eclipse?

Janet Charbonneau (852654) | asked May 09 '19, 4:55 p.m.
Our customer would like to be able to track the comments made during a change in the release date.  When a user puts in a Release Change Comment (custom attribute), then the customer would like to have the date/time, user, and Release Change Comment appended to another attribute.  Essentially we are trying to mimic the functionality of the Discussion (Comments) area.

We have been able to create a Comments History attribute and have the new Release Change Comment appended to that attribute with the date/time.  However, we would also like to be able to record the user that made that comment.  They need to have this functionality usable in both the web UI and the Eclipse client.  We have only been successful in one scenario and that is when you make the change in the web UI and the Comments History attribute has the Release Change Comment attribute as its dependent.  Unfortunately, this will write it in the Comments History every time the user types in the Release Change Comment attribute.  Essentially we need it to work correctly during the "Save" of the work item.

I have scoured and have not seen a solution, but the questions have been pretty old.  I wanted to see if anything has changed in a current release to be able to support retrieving the name of the current user in both the web UI and Eclipse client.

If that is not possible, is there another alternative to be able to mimic the functionality of the Discussion area (without using the built-in comments/discussion area since they need to be able to use that separately.)

Accepted answer

permanent link
Ralph Schoon (63.2k33646) | answered May 10 '19, 2:42 a.m.

 As far as I am aware this is not supported. There is a way to access the browser context in the Web UI to get the current user which is strictly speaking also not supported.

To implement something as complex as you describe you could create a work item save participant (Java Server Extension for work item save). The caveat is that the changes actually happen as a second save.

Janet Charbonneau selected this answer as the correct answer

Your answer

Register or 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.