Reputation: 380
I was looking for a method getShortName() or attribute of UserName that would return the shortName/UserID of someone who has authenticated with the Domino server. Did a search on the forums, StackOverflow and was unable to find any such method except in the Registration Class.
I'll post my alternative solution below, but if anyone has a better solution I would love to hear it.
Thanks,
Dan
Upvotes: 0
Views: 432
Reputation: 21709
You can use the formula command @NameLookup() to return items from a person document. Together with session.evaluate() you should be able to use it in XPages.
Try this:
session.evaluate('@NameLookup([EXHAUSTIVE];' + userName + ';"ShortName")');
Disclaimer: not tested at all.
Upvotes: 2
Reputation: 373
Not sure what version of the NAB has the hidden view called ($NamesFieldLookup), but if I recall it will include the CN=Bugs Bunny/OU=ACME/O=COM in the first sorted column. This would allow you to skip the first step of your code. Other than that not aware of a provided method to get the short name.
Upvotes: 0
Reputation: 380
My solution follows:
var userName = @Name("[ABBREVIATE]" ,@UserName());
var shortName = @DbLookup([@DbName()[0],'names.nsf'],'($VIMPeople)',userName,"ShortName");
return shortName;
Upvotes: 0