Symptoms

Attempt to delete a user fails with one of the error messages below:

1) ODBC code #23503: ERROR: update or delete on table "Users" violates foreign key constraint "AcceptedTerms_UsersID" on table "AcceptedTerms" Key (UsersID)=([user_id]) is still referenced from table "AcceptedTerms".; Error while executing the query

2) ODBC error #23000: [Microsoft][ODBC SQL Server Driver][SQL Server]The DELETE statement conflicted with the REFERENCE constraint "ARDoc_Crtd_User_UsersID". The conflict occurred in database "pba", table "dbo.ARDoc", column 'Crtd_User_UsersID'.ODBC error #01000: [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.ODBC error #01000:

ODBC code #23503: ERROR: update or delete on "Users" violates foreign key constraint "ARDoc_Crtd_User_UsersID" on "ARDoc" Key (UsersID)=(xxxx) is still referenced from table "ARDoc"

3) ODBC code #23503: ERROR: update or delete on "Users" violates foreign key constraint "ADomain_OwnerUsersID" on "ADomain" Key (UsersID) is still referenced from table "ADomain"

4) update or delete on table "Users" violates foreign key constraint "UserToken_UsersID" on table "UserToken". Key (UsersID)=(ID) is still referenced from table "UserToken"

5)  ERROR: update or delete on table "Users" violates foreign key constraint "PayToolStatusHist_ChangedB_040" on table "PayToolStatusHist" DETAIL: Key (UsersID)=(ID) is still referenced from table "PayToolStatusHist". 

Cause

It is not possible to delete the user, as BA keeps the history of all billing-related actions performed by all users and does not allow it to be removed. This ensures that all actions can be audited and checked.

1) the user accepted the Terms and Conditions assigned to the service plan that the customer's subscriptions are based on;

2) the user created some financial documents;

3) the user is listed as a domain owner;

4) token generated was not deleted; the issue is confirmed as a bug with id #PBA-74988 ("Not possible to delete user if Token was generated for it").

5) the user made some changes with the payment methods (e.g. deleted credit card).

Resolution

The ability to delete staff members and users has been requested as a feature, its id is #PFR-513 ("Ability to delete Staff Members ").

For the cases 1,2,4 - disable the staff member (Disable User button) instead of removing it.

For the case 3 reassign the domain owner: Home > Services > Domains > Domain #ID name Manage Contacts button in the Contact Info part of the page.

Internal content

Link on internal Article