Understanding the message "Person: You cannot delete this Person because it is linked to x [record type]"
Who is this article for?Users attempting to delete a person.
There are two ways to resolve this problem, one is for users, one requires input from a database administrator.
When attempting to delete a Staff or Contact person, you may get the information message: "Person: You cannot delete this Person because it is linked to x [record type]". For example: "Person: You cannot delete this Person because it is linked to 4 Actions". This article explains what causes the issue and how to resolve it.
1. Issue
This message appears because the person you are trying to delete is in some way referred to in a record, and deleting them would cause an integrity problem.
Note: If the person has logged in to the system then it will not be possible to delete them. They will have left an entry in the login history; deleting them would break the audit trail, and hence we do not allow the deletion.
But, if they have never logged in and you are seeing this message, it is because there are records in the system that refer to them in some way. They might be an owner (e.g. an Action Owner), or noted in some other way (e.g. an Interested Party). The solution is to locate each record that points to them, and remove the link before trying to delete them again.
2. Solution 1: pinpointing the blocker via the application
The Analysis and Action Tracker modules can help you locate the problem records:
- For the record type shown in the message, go to the relevant module.
- On the data grid, add the fields that contain person names.
- Filter the results on the person's name.
Once you have located the record(s), you can edit to remove the reference.
3. Solution 2: pinpointing the blocker by scanning the database
Sometimes it will be useful to look directly at the database, for example if there are many fields containing names or if you have custom fields that don't appear on the data grid field chooser.
In that case, the script attached below can be used to find the blocking records. To use:
- Find your person's GUID. Assuming their email address is filled in, this would work:
SELECT [GUID] FROM Person WHERE Email = 'person@domain.com';
- Edit the script to replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with the real GUID.
- Run the script.
The output shows the table and column containing the link to the person. This can then be used to focus on the relevant parts of the data in the Analysis screen in the application, or RowID can be used to further interrogate the database.