cancel
Showing results for 
Search instead for 
Did you mean: 

Dynpro Java - Modify Portal User ID Attributes

Former Member
0 Kudos

Hi , I am trying to change the attributes of a portal user id, via web dynpro Java code by using this code -

Below code is working fine for creating portal users, but not for modifying them.

** IUserFactory userFact = UMFactory.getUserFactory();**

** IUserMaint modUser = null;**

*try {*

** modUser = userFact.getMutableUser("X_User1");**

** } catch (UMException umex) {**

** //name clash will be caught here. User will not be created.**

** //logger.catching(Category.getCategory(Category.SYSTEM,"ELUM"), umex);**

** manager.reportException(umex.getLocalizedMessage(),true);**

** return false;**

** }**

**

** modUser.setFirstName("DiffFirstName");**

Its saying modUser already Exists and is not unique. ( as code assumes , it has to create a new id instead of changing one ).

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Try this code to change the attribute.

try {

IWDClientUser LoggedUser = WDClientUser.getCurrentUser();

IUserMaint User = UMFactory.getUserFactory().getMutableUser(LoggedUser.getSAPUser().getUniqueID());

User.setFirstName("true");

User.commit();

} catch (UMException e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(),true);

}

catch(WDUMException e1)

{

wdComponentAPI.getMessageManager().reportException(e1.getMessage(),true);

}

Revert in case of problems.

Best Wishes

Idhaya R

Former Member
0 Kudos

Thanks both of you Guys .. for very valuable inputs,

That did it.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you need to pass a Uniwue name for getting the Mutable user i.e here

    • modUser = userFact.getMutableUser("X_User1");**

here X_User1 is not a unique name. You can find the unique name in the Identity managemnt or get the Unique name dynamicaaly by this code

UMFactory.getUserFactory().getUserByLogonID("X_User1").getUniqueID()

where X_User1 is the login ID of the user.

Regards,

Raju Bonagiri