on 03-04-2009 8:32 AM
Hi there,
Anyone knows what code do I write to retrieve the ID of the employee who is currently logged in?
Hi,
Use the below code.
String strUserName = null;
try {
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
if (sapUser != null) {
IUserAccount[] acct = sapUser.getUserAccounts();
if (acct[0] != null) {
strUserName = acct[0].getDisplayName();
}
}
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The string strUserName gives you the logged in user. and add the required jar files.
Thanks,
Prasanthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are you still facing problem in retrieving USER ID of logged in user?
Thanks,
Prasanthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jackson,
Its the same Id by whichyou have logegd in. Its just that it comes with some prefix and suffix in that. Please refer to my first reply where I have mentioned that you can write a simple java loic to extract the userid from the string which you got.
Can you please let us know that :-
1) What is the user name with which you have logged on?
2) What is the encrypted string which you are getting?
Then accordingly i can send you the code for getting the exact ID. You can try to get the ID yourself however in case you want some help just let me know.
I hope this helps!
Thanks and Regards,
Pravesh
Thank you so much!! I will try and let you guys know!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To add the jar files,
In addition to code mentioned you will need to add external jars in the build path of your project. You can do this by right clicking on your Project Name ==> Properties ==> Java Build path ==> Libraries ==> Add external jars.
the jars you need to add for this are,
com.sap.security.api.jar
com.sap.security.api.perm.jar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jackson,
Use this:
String loggedOnUserID = WDClientUser.getCurrentUser().getClientUserID();
If you use this code then you need not have to add any external Jars!! Also you can check the format of the ClientUserID, if it needs some manipulation to get the way you want to have the UserID then you can easily do that using JAVA API's.
I hope this helps!! Please revert back in case you have any issues!!
Thanks and Regards
Pravesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.