Tuesday, 22 December 2015

Exception while retrieving user. Exception is : IAM-3056160:Modify User Profile request cannot set or change attribute E-mail, since it is not defined in the corresponding data set.:Modify User Profile:E-mail

Modifying OIM User Attributes Using UserManger API:

We would need an instance of UserManager class,this class provides us with method that modify user object. In order to get the UserManager object, the following snippet of code can be used:


public void modifyUser(String userKey,OIMClient oimclient){
    UserManager usrMgr = oimclient.getService(UserManager.class);
    User user = new User(userKey); //Pass the user_key while creating
    user.setAttribute("First Name", “Dummy”);
    user.setAttribute("Last Name", "User");
    user.setAttribute("Email", "dummyuser@example.com");
    try {
        usrMgr.modify(user);
    } catch (ValidationFailedException e) {
        e.printStackTrace();
    } catch (UserModifyException e) {
        e.printStackTrace();
    } catch (NoSuchUserException e) {
       e.printStackTrace();
   } catch (AccessDeniedException e) {
      e.printStackTrace();
   }
}
While modifying make sure the attribute name is correct,for example while setting the email id for the user ,if instead of Email the key used is E-mail/EMail ,then you will get following exception

[Exception while retrieving user. Exception is : IAM-3056160:Modify User Profile request cannot set or change attribute E-mail, since it is not defined in the corresponding data set.:Modify User Profile:E-mail]

Though a small thing, you might end up wasting your day or crucial hours figuring out the root cause.
Here is the list of OIM attributes for quick reference:
Use names after "."
Organizations.Key
Organizations.Organization Name
Users.AD Reference
Users.Creation Date
Users.Deprovisioned Date
Users.Deprovisioning Date
Users.Disable User
Users.End Date
Users.First Name
Users.Identity
Users.Key
Users.Last Name
Users.Manager Key
Users.Manager Login
Users.Manager First Name
Users.Manager Last Name
Users.Middle Name
Users.Note
Users.Provisioned Date
Users.Provisioning Date
Users.Role
Users.Row Version
Users.Start Date
Users.Status
Users.Update Date
Users.Updated By
Users.User ID
Users.Xellerate Type
Users.Lock User
Users.Email

Thanks!!