User temporary password and custom field entry

I am trying to update the temporary password of a newly created user, for this I have the following code. But when I am trying to execute its failing. Could you please verify and le me know the corrections. 

private String targetuser;
private String defaultpwd;
private Boolean issuccess = false;
private String errmessage;
private User user;
private UserService userService;

@Override
public void run() throws SmartServiceException {

try {
userService.changeUserPassword(targetuser, defaultpwd.getBytes(), true);
} catch (InvalidUserException | PrivilegeException e) {

errmessage = e.getMessage();
}
}

 

appian-plugin.xml 

<smart-service name="Set User Password" key="SetUserPassword"
class="com.xxxxx.dtestplugins.SetUserPassword" />

  Discussion posts and replies are publicly visible