cancel
Showing results for 
Search instead for 
Did you mean: 

error getting for following code"portal_user_name = user.getUniqueID();"

Former Member
0 Kudos

hi,

i am getting error on following line of code(second line).

user = (IUser)WDClientUser.getCurrentUser().getSAPUser();

portal_user_name = user.getUniqueID();

only thing is,it was working fine before.now it is not working.

i am getting error as null point exception.

please help on this error.

thanks in advance

jayesh talreja

Accepted Solutions (1)

Accepted Solutions (1)

siddharth_jain
Active Contributor
0 Kudos

Hi,

try the following line of code and see if it works:

user = (IUser)WDClientUser.getloggedInClientUser().getSAPUser();

portal_user_name = user.getUniqueID();

also make sure that the user exist in UME

Siddharth

Former Member
0 Kudos

hi,

thanks for reply .

but as i am using through portal.so portal user id has to be in UME(i guess so).

and more for same user it was working fine before.

thanks

jayesh talreja

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Try the following code for fetching the portal user name and other details.

Do remember to set Authentication as True.

IWDClientUser clientuser = WDClientUser.getCurrentUser();

IUser user = clientuser.getSAPUser();

String displayname = user.getDisplayName();

wdContext.currentContextElement().setDsiplayname(displayname);

String uniquename = user.getUniqueID();

wdContext.currentContextElement().setUniquename(uniquename);

String firstname = user.getFirstName();

wdContext.currentContextElement().setFirstname(firstname);

String uid = user.getUid();

wdContext.currentContextElement().setUid(uid);

String jobtitle = user.getJobTitle();

wdContext.currentContextElement().setJobtitle(jobtitle);

String lastname = user.getLastName();

wdContext.currentContextElement() .setLastname(lastname);

'

I hope this will be helpful to u.

Thanx.

former_member205363
Contributor
0 Kudos

Hi Jayesh,

I am getting Portal User with the following code with out any problem, try this......

IWDClientUser user = WDClientUser.getLoggedInClientUser();

String name = user.getFirstName();

name = name" "user.getLastName();

Regards,

Lakshmi Prasad.

siddharth_jain
Active Contributor
0 Kudos

Hi,

Are you able to get the other properties of User like First name Last name,Unique name with the Api.

Make sure that WD application Authentication property is set to true.

Also for that Particular user you can check in Identity Management whether the user credentials like Unique id exist in UME.

try login with different users and see if the problem persist only with a particular user.

siddharth