Home
About
Search
Welcome to M-Files Empower – our new support experience. We'd love to hear what you think!Give feedback
Home/Support and troubleshooting/Troubleshooting/Error resolution

Cannot delete vault object due to missing DELETE statement even after disconnecting its database

Last updated on 21 March 2022 · 3 min read

Admin
Connections to External Databases (Integrated)

Overview

When trying to delete an object in the vault, you may get an exception similar to this:

This object type uses a connection to an external database. You cannot delete objects of this type, because the administrator has not specified a DELETE statement for the object type.

It means that the object you are trying to delete is connected to an external database and it is not configured to allow M-Files to delete rows from that database.

If you connect the vault to a database view and not an actual table, you will be unable to define a DELETE statement for it.

When you disconnect the database, you may still get the same error when trying to delete the same object.

Notes

If you need to delete such objects forcefully from the vault, consider first the following:

  • If they are still in the external database, should they be deleted in the vault at all? The next synchronization will bring them back. Consider deleting them in the external database, so that the next full refresh will delete them from the vault automatically.
  • If you need to allow users to delete objects, you may want to define a DELETE statement for this connection. You can control the user rights via M-Files ACLs to determine that only certain users/groups can delete objects in the vault.

If you will be cleaning up the vault manually by following the information below, consider doing so outside of business hours, because it will require changing the metadata setup of the vault and it can allow otherwise invalid operations for the duration of the maintenance task (such as deletion of objects that otherwise cannot be deleted, or making "orphan" objects whose parent is deleted unexpectedly).

Solution

If, for some reason, you still need to delete such objects in the vault only, you need to first disconnect the external connection. You can set it up again when you are done cleaning up the vault.

Before unselecting the This object type uses a connection to an external database. You cannot delete objects of this type, because the administrator has not specified a DELETE statement for the object type. checkbox, make sure to save the connection settings, including the property mappings, because they will be lost. 

If you keep getting the same error, the most likely cause is that there is object hierarchy defined for this object, and the child object is also connected to an external database and its connection does not allow deleting either.

In such a case, M-Files tries to delete the child object as well, as long as hierarchy is defined. This means you have two options depending on what you want to achieve:

  • Recursively go through child objects hierarchies and apply this article (for example, allow their deletion, or remove their database connection).
  • Or, remove the hierarchy. With this, M-Files will not try to delete the existing child objects for the parent object type. You can restore the hierarchy after you are done cleaning up the vault.

Still need help?