cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read user name

Former Member
0 Kudos

Hi,

I have used the following code to read the user who has logged into the portal. However my WDJ application fails to return the user name for one particular user. Any suggestions ?



		IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
		IUser sapUser = wdClientUser.getSAPUser();
		if (sapUser != null) 
		{
			IUserAccount[] acct = sapUser.getUserAccounts();
			if (acct[0] != null) 
			{
				String strUserName = acct[0].getDisplayName();
				strUserName=strUserName.toUpperCase();
				userID = strUserName;				
							
			}
		}

Accepted Solutions (1)

Accepted Solutions (1)

former_member185086
Active Contributor
0 Kudos

Hi

Try this

String logonID = "";
 
		try
		{
 
			IWDClientUser wdUser = null;
			try
			{
				wdUser = WDClientUser.getCurrentUser();
			}
			catch (WDUMException e1)
			{
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
 
			
			IUser user = wdUser.getSAPUser();
			logonID = user.getUniqueName();
 
		}
		catch (Exception e)
		{
			
		}

Best Regards

Satish Kumar

Former Member
0 Kudos

Thanks Satish.

I am not trying for any alternative approach, My code has been working for all the user. I am not able to understand why it doesnt work for one user alone.

Former Member
0 Kudos

Hi,

In your code you are retrieving Display Name as you are getting the display name for all other users and not getting only for one user please check if the Name is set for that particular user as it is not a mandatory field.

Ninad

Former Member
0 Kudos

Hi Ninad,

Thanks for the reply. Are you asking me to check the user attributes that are maintained in the Portal User Management ?

Former Member
0 Kudos

Yes..You need to search in User management by putting the user id.

Is there any 1st name and last name is maintained or not.

Thanks

Kanai

Answers (0)