5 Replies Latest reply: Nov 29, 2012 10:10 PM by Nishith Nayan RSS

    OIM 11g R2 -Updating UDF through code

    user608228
      Hi,

      I am using the below code to update the UDF and getting "oracle.iam.identity.exception.ValidationFailedException: IAM-3056160:Modify User Profile request cannot set or change attribute USR_UDF_TEMPUSERNAME, since it is not defined in the corresponding data set.:Modify User Profile:USR_UDF_TEMPUSERNAME"

      UserManager usrMgr = Platform.getService(UserManager.class);
      System.out.println("User Key :: "+usrKey);
      HashMap<String, Object> attrMap = new HashMap<String, Object>();
      attrMap.put("USR_UDF_TEMPUSERNAME",attrValue);
      User user = new User(String.valueOf(usrKey), attrMap);
      UserManagerResult result = usrMgr.modify("User Login", usrLogin, user);

      Can some one please help me out on this.

      Thanks
        • 1. Re: OIM 11g R2 -Updating UDF through code
          Rajiv Dewan
          HashMap<String, Object> attrMap = new HashMap<String, Object>();
          attrMap.put("*LABEL NAME*",attrValue);
          User user = new User(String.valueOf(usrKey), attrMap);
          UserManagerResult result = usrMgr.modify("User Login", usrLogin, user);

          http://rajivdewan.blogspot.com/2011/12/metadata-for-oim-user-profile-for-11g.html
          • 2. Re: OIM 11g R2 -Updating UDF through code
            user608228
            Hi Rajiv,

            No luck, I still get the same error even after I updated the code to have label of the attribute instead of the actual UDF column name:

            IAM-3056160:Modify User Profile request cannot set or change attribute TempUserName, since it is not defined in the corresponding data set.:Modify User Profile:TempUserName


            Thanks
            • 3. Re: OIM 11g R2 -Updating UDF through code
              Rajiv Dewan
              HashMap<String, Object> attrMap = new HashMap<String, Object>();
                        attrMap.put("TempUserName", "5555");
                        User user = new User("21", attrMap);
                        try {
                             UserManagerResult result = userManager.modify("User Login", "TESTUSER01", user);
              } catch (Exception e) {
                             e.printStackTrace();
                        }

              It works. Which user are you using to get UserManager Service ?
              • 4. Re: OIM 11g R2 -Updating UDF through code
                user608228
                Hi Rajiv,

                I quite did not get your question. Here is the code:

                Long usrKey = getUserKey(usrLogin); //usrLogin is of the user whose attribute is to be updated
                UserManager usrMgr = Platform.getService(UserManager.class);

                HashMap<String, Object> attrMap = new HashMap<String, Object>();
                String attrName = "TempUserName";
                String attrValue = "TestUser1";

                attrMap.put(attrName,attrValue);
                User user = new User(String.valueOf(usrKey), attrMap);

                UserManagerResult result = usrMgr.modify("User Login", usrLogin, user);

                Thanks
                • 5. Re: OIM 11g R2 -Updating UDF through code
                  Nishith Nayan
                  code seems fine to me. Problem is, you have not added these custom attribute(UDF) on Modify page. you have to add separately for all three pages (Create User,Modify User and User Detail)

                  I would say create sandbox. select any user click on modify now the modify screen will be appeared. click on customization and add your UDF from Catalog data component same as create user.
                  Similarly add for User Detail page. open user detail page and include same udf from Managed User->UserVo1 data component