AnsweredAssumed Answered

Error saviing new users from code

Question asked by jlabuelo on Jun 18, 2015
Good Morning all

I am trying to create a new user by custom code in Sugar CE 6.5. The code seems to work, the user appears in the list of users, also the user table in the DB seems to be ok, if I try to log in using this username and password the user is able to log in..., however if I try to Edit the user to change the password using the Admin user, when I click on save, an error appears in the SugarCRM screen.

"There is already an existing user with this username, please select a new username for this user before saving changes."

Why is this happening?

Here is the code I use to create the user.

Thanks a lot!!

$sugar_user = new User(); 
$sugar_user->employee_status = $vet_act->estado;