It's all about the answers!

Ask a question

How to use Javascript to set the logon user (authenticated user) as default OWNER?

Lauren Nguyen (111) | asked May 20 '15, 6:39 p.m.
I have a Javascript that based on certain WorkItemAttributes.TYPE, it sets a specific user to the WorkItemAttributes.OWNER, otherwise, I would like to use the logon user (i.e., 'authenticated user' seen in Customization attribute for User) to be the default OWNER. So how do I get the UUID of the logon user/authenticated user using Javascript?

2 answers

permanent link
Donald Nong (14.5k414) | answered May 20 '15, 7:53 p.m.
Not sure whether you can get the UUID, but using JavaScript to get the current logged on user was quite a popular topic in the forum in the past. See the answers in these post for code snippets.

If you are new to attribute customization, this tutorial is a good start.

And you can find most of the API specifications here.

Lauren Nguyen commented May 21 '15, 1:21 p.m.

Thanks, Donald, for replying. From what I've read, there's NO way to get the logged on user from Attribute Customization using Javascript. Too bad though because it seems to be a very useful thing to have as it has been a popular topic in the forum.

permanent link
Ralph Schoon (62.9k33645) | answered May 21 '15, 3:53 p.m.
Please see answer for how to get the item ID for the user that runs the operation.

Ralph Schoon commented May 21 '15, 3:54 p.m.

Thanks to Amaury Quintero for providing this info.

Lauren Nguyen commented May 21 '15, 4:43 p.m.

Hi Ralph, unfortunately, with JavaScript for work item customization, the use of is not accessible.

Lauren Nguyen commented May 21 '15, 4:48 p.m.

Ralph, I believe that in , you also commented that "I tried that in the context of a Calculated Value Provider and the dojo.require() statement for the Session object prevents the script from loading. The internal scripting engine does not have the session object exposed. indicates that there is no access to the logged in user."

And that's the same problem I'm experiencing, i.e., cannot load the Session.

Your answer

Register or to post your answer.