Automic Workload Automation

Expand all | Collapse all

Java set password for user

Jump to Best Answer
  • 1.  Java set password for user

    Posted 07-25-2016 05:34 AM
    Hello,

    I'm currently try to find out how to change the password of an user in UC4 via the Java API. From other posts I could get the information that I have to use the class user, get the attributes and then call the setPassword function, but i can't get it working ...


    My (Pseudo-) code:
      OpenObject o  = new OpenObject(Username);
      sendRequestAndWait(o);

      User user = (User) o.getUC4Object();
      user.attributes().setPassword(newPW);


    I think I have to send the informations to the UC4 system again, but don't know how and haven't found something about that ... Sorry for this question, but I'm really new to this topic ...

    Thanks for your help

    Tim



  • 2.  Java set password for user
    Best Answer

    Posted 07-25-2016 06:31 AM
    Hi Tim,

    you have to use something like this:

    UC4UserName name = new UC4UserName("Name/Dep");
          
    OpenObject open = new OpenObject(name,false,true);
    uc4.sendRequestAndWait(open);
    UC4Object obj = open.getUC4Object();
           
    User user = (User) obj;
    user.attributes().setPassword(..pw...);
    SaveObject save = new SaveObject(user,true);
    uc4.sendRequestAndWait(save);

    Best regards


  • 3.  Java set password for user

    Posted 07-25-2016 06:42 AM
    Hey Nicolai,

    Thanks I missed the SaveObject statement. Works perfectly now ;)

    Best regards