private static final String USER_ID = "INSERT_USER_ID_HERE";
public static void runExample(DfpServices dfpServices, DfpSession session, long userId)
throws Exception {
// Get the UserService.
UserServiceInterface userService = dfpServices.get(session, UserServiceInterface.class);
// Get the user.
User user = userService.getUser(userId);
// Set the role of the user to a salesperson.
// To determine what other roles exist, run GetAllRoles.java.
user.setRoleId(-5L);
// Update the user on the server.
User[] users = userService.updateUsers(new User[] {user});
for (User updatedUser : users) {
System.out.printf("User with ID \"%d\" and name \"%s\" was updated.\n",
updatedUser.getId(), updatedUser.getName());
}