Errors when deleting a user created with a bean

Hello all,
I made a user yesterday using a bean, and it seemed to work just fine. I forgot an email address, though, so I wanted to edit my PHP file (where the bean is used), delete the user through the CRM site, and re-run the file to make the user again.

When I try to delete the user, though, it fails. I get no errors on the screen, but the log shows me some odd problems:

  • unable to find relationship projects_users_resources
  • error loading relationship project_resource
  • unable to find relationship am_projectTemplates_users_resources
  • error loading relationship am_projectTemplates_users_resources

My bean is pretty simple:

$newUserBean = BeanFactory::NewBean(‘Users’, $newUserBeanID);
$newUserBean->first_name = “Alex”;
//and so on for name, username, etc
$newUserBean->save();

And that’s all there is to it. My file goes on to find another user and display the first name, but that’s just a holdover from when I was practicing with bean methods. Besides, it echos something so I know I’m in the right place and I can test that changes to the PHP register in the file (they don’t yet, but that’s another topic). The new user bean does nothing after the call to save().

Am I missing a step? I’m not sure what these projects are or how to handle them when making new users, and my user is created with no errors. What am I missing? Thanks!

I never created users using Beans, but perhaps that is a special kind of object in the system, that requires more care. Maybe you can try checking the code that creates a user from the UI, and see what else it does (like maybe create those relationships it’s now complaining about).

You can also get insights checking the database with phpMyAdmin or similar.

When you search for code online, search also for stuff related to SugarCRMup to version 6.5, which was the one from which SuiteCRM was forked, so it’s similar in many respects.