3 Replies Latest reply: Jan 24, 2013 5:00 PM by idamGod RSS

    Create user using API in OIM11g R2 with custom attributes

    942393
      Friends,

      I am trying to create a user using API in OIM 11gR2 with a custom attribute.

      HashMap<String,Object> createUserMap=new HashMap<String, Object>();
      createUserMap.put(UserManagerConstants.AttributeName.FIRSTNAME.getId(), "Test);
      createUserMap.put(UserManagerConstants.AttributeName.LASTNAME.getId(), "Tester);
      createUserMap.put(UserManagerConstants.AttributeName.USER_LOGIN.getId(), "tester1");
      createUserMap.put(UserManagerConstants.AttributeName.USERTYPE.getId(), "End-User");
      createUserMap.put(UserManagerConstants.AttributeName.EMPTYPE.getId(), "EMP");
      createUserMap.put(UserManagerConstants.AttributeName.PASSWORD.getId(), "Welcome1);
      createUserMap.put(UserManagerConstants.AttributeName.EMAIL.getId(), "test@test.com");
      createUserMap.put("act_key", new Long("1"));
      createUserMap.put("USR_UDF_DEPTNO", "10");

      try
      {
      UserManager userService = oimClient.getService(UserManager.class);

      User user=new User(userLogin,createUserMap);
      UserManagerResult result = userService.create(user);
      System.out.println("Creation status: '" + result.getStatus());
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }

      But it is failing with the below error.
      *Create User request cannot set or change attribute USR_UDF_DEPTNO, since it is not defined in the corresponding data set.:Create User:USR_UDF_DEPTNO.*

      But this attribute does exist in oim and i was able to create user using UI along with this custom attribute.

      Please let me know what i am doing wrong.