Documentation Center

Delete plugins

This is a category of plugins, of type IDeleteMetadataPlugin, that will run just before deleting the object in the database.

Purpose

These types of plugins can use the metadata of an object to perform pre-deletion checks such as:
  • checking if the object be deleted
  • keeping track of which objects are being deleted

Types of objects

Delete plugins are supported on objects of the following types:
  • ISHMasterDoc
  • ISHModule
  • ISHIllustration
  • ISHTemplate
  • ISHLibrary
  • ISHPublication
  • ISHBaseline

ISHLevel condition

By default, a delete plugin executes when any object of a supported type is about to be deleted, regardless of its level (logical, version or language).

You can change this default behavior using the ISHLevel condition in the plugin configuration. ISHLevel lets you restrict the execution of a delete plugin to occur only when an object of a specific level is about to be deleted.

For example, if you set ISHLevel to lng for a delete plugin, then that plugin is executed only when a language item is about to deleted.

OriginalLevel condition

It's important to understand that deletion has cascade effects: deletion of an item on one level may cause the triggered deletion of other items on other levels. Those triggered deletions may themselves trigger the execution of delete plugins.

For example, if a topic (logical item) has 3 versions, and each version has 5 languages, then the deletion of the logical item triggers the execution of 1 + 3 + 3*5 = 19 delete plugins, and the deletion of 19 items. For another example, if you delete all language items under a version, you trigger the delete plugin for, and the deletion of, the version item itself as well.

It may be that you don't want delete plugins to be triggered indirectly. It may be that you want an item's delete plugin to be triggered only if the item itself is directly deleted, and not when its deletion is indirectly triggered by the deletion of another item on a different level. To achieve this, use the OriginalLevel condition, which specifies the level of the original delete action that was initiated. By setting this condition to the same value as ISHLevel, you can ensure that the plugin is triggered only directly, not indirectly.

Here are some examples of how ISHLevel and OriginalLevel interact:
  • If a delete plugin has ISHLevel set to lng, and OriginalLevel not set at all, then the plugin executes whenever a language item is deleted.
  • If a delete plugin has both ISHLevel and OriginalLevel set to lng, then the plugin executes only when a language item is directly deleted.
  • If a delete plugin has ISHLevel set to lng and OriginalLevel set to logical, then the plugin executes only when a language item is deleted as an indirect result of its higher-level logical item being deleted.