XPage: Retrieving user name through ServerSide JavaScript always returns the server's name

don’t know if this is a true problem or rather a question:

in postSaveDocument event of an XPage datasource I’m trying to retrieve the name of the user who as just submitted the page. I tried session.getUserName() as well as session.getEffectiveUserName():

usrName = session.getUserName();

print(usrName);

the server console always returns the server’s own name, never mine (yes, I’m absolutely sure that I’m not logged in as the server!).

I know how to accomplish something like this using standard Domino web agents but I don’t have an idea what’s going wrong here.

Question 1: can someone please confirm / deny this?

Question 2: how can I truly return the submitter’s name?

Subject: Yes

The 8.5 discussion database uses the following computing server side javascript:

var userName:NotesName = session.createName(@UserName());

return(userName.getCommon());

Subject: update…

ok, I tried the discussion db trick, and it worked as planned. Then I again tried the direct method using

sesssion.getEffectiveUserName();

and now that worked too as expected (really wonder why it didn’t the other day, but anyways…).

Whereas

session.getUserName();

indeed returns the server’s distinguished name. Which was to be expected.

Thanks again for your hint…

Subject: yes this is because…

getUsername() returns the name of the current ID being used, which is the server ID when running inside Domino. I hate this behavior, but changing it would break existing apps. So we added getEffectiveUser(0 to get the web user name.

Subject: thanks, but…

I’ll certainly give that a try asap (as a workaround I also thought about querying a cgi variable…)

But, just for the sake of plain knowledge ;-): according to Help a plain old

session.getUserName() or

session.getEffectiveUserName()

should be giving me the name of the user actually having initiated that piece of code. Or am I getting that wrong?