Error Deleting Users from Free App

Error Deleting Users from Free App

  
I downloaded one of the free apps just to check it out, and when I was done, I deleted it. I opened the Users application to delete all of the users that were created automatically in the free app, but every time I try to delete a user I get this error:
The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_rnu_Employee_OSSYS_USER_USERID". The conflict occurred in database "outsystems", table "dbo.OSUSR_RNU_EMPLOYEE", column 'USERID'. The statement has been terminated.
How do I fix this?
Hi Britni

That error means that the user you're attempting to delete is still being referenced by other entities in data models of the deleted espace, or even other espaces. When deleting an application or espace, it's data model isn't deleted for security/data loss prevention reasons.

On this particular case, the user you're attempting to delete is referenced by the Employee entity of the Employees espace, which is an espace that exists on several applications (like Directory and Expenses). So deleting the Employees information may impact your other applications, since the datamodel is shared between them.

Why do you need to delete the users? Which application have you deleted?

Cheers

Miguel Simões João
I honestly don't remember which one it was that I downloaded that did it. Sorry :(  I think at some point I tried out both the Sales and eCommerce apps, but I'm assuming there wouldn't be an Employee entity tied to either of those so I'm not sure. It's been awhile since I tried them – I just didn't go back to delete those users until now.

I wanted to delete the users because now there's 175 users listed that are fake people and it's making it harder to find and manage real users.

Do I need to download the app again (whichever one it is ...) and delete them from there?
Hi Britni

Well, it really depends on the apps you've installed and deleted. Some of them, like Directory, and button to delete the sample data, but only if it's not in use by other apps.

At this point, I don't think you have a pretty solution to clear those users, other then:
  • access the database directly and delete the entries from employee table manually, and if necessary from other tables that reference the employee table as well
  • or start fresh using a clean database, but not before backing up your applications and critical data.
But if the problem is just managing "real" users on the Users application, you can deactivate the users you don't want. Unfortunately, there's no action for it on the Users espace, but you can create you own esapce, with the Users as UserProvider, and update the users by setting the value IS_ACTIVE to False. This way they will not show on the Users list anymore.

Cheers

Miguel Simões João 
Thanks for the tips, Miguel.

Originally I tried your last suggestion and set the sample users to inactive. This was fine at first, until all the extra users set the number of users over my limit for my license. So now I'm going back to actually delete the users. I don't want to mess anything up, so I just wanted to make sure I have this right first ... Should I be deleting the entries I don't need in the ossys_User table? If needed, what other tables would I need to delete entries from?

Thank you!

EDIT: Scratch that ... I was able to find all the tables and successfully delete all the users. Thanks for the suggestions!
Hi Britni,

I'm running into the same issue. Can you please elaborate on how you were able to delete all the sample users?  I can't seem to locate ossys_User table.


Britni Mooney wrote
:
Thanks for the tips, Miguel.

Originally I tried your last suggestion and set the sample users to inactive. This was fine at first, until all the extra users set the number of users over my limit for my license. So now I'm going back to actually delete the users. I don't want to mess anything up, so I just wanted to make sure I have this right first ... Should I be deleting the entries I don't need in the ossys_User table? If needed, what other tables would I need to delete entries from?

Thank you!

EDIT: Scratch that ... I was able to find all the tables and successfully delete all the users. Thanks for the suggestions!
 
 
Nouman,

I apologize - it's been awhile, so I don't remember the exact steps. I just remember that I went directly into the database and found the ossys_User table. Several of the attributes were referenced in other tables, so I had to figure out what was connected and delete the data for those sample users only in each of the other tables. After all the references were removed, then I deleted those users from the ossys_User table.