Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Advanced extensibility through stereotype scripts and script items > Extending delete behavior through stereotypes and scripts > Overview of extending delete behavior through stereotypes and scripts
  
Overview of extending delete behavior through stereotypes and scripts
You can make Modeler run a script when an item or diagram is going to be deleted. The script is run before deleting the item or diagram from the model.
This is useful if you are using customized items and diagrams in Modeler, and you want to propagate the deletion of an item, for example, to delete items that are linked through a specific Stereotype.
When applied to an item or diagram, an on delete script is called when that item or diagram is going to be deleted. The on delete script can prevent the deletion from occurring.
You can apply on delete scripts to items and diagrams through Stereotypes or Scripts:
If you want an on delete script to apply only to specific items or diagrams, use a Stereotype to define and apply the on delete script.
* 
The 'Apply to All Objects of Associated Model Item Types' option does not apply on delete scripts to any diagrams.
If you want an on delete script to apply to all items or diagrams of a specified type, such as all Classes or Class Diagrams, use a Script.
If an item has more than one on delete script applied, only the first script is run.
Key:
Remarked variable names at the top of the file are available in all functions underneath except where stated.
Remarked variable names immediately above functions are only available in those functions (or subfunctions called).
The comment line '---Context change--- indicates that script is unloaded and reloaded here between function calls - this means that script scoped variables cannot be used to transfer data between functions separated by one of these comment lines, and other methods (such as helper dlls) should be used in the (fairly rare) situation that this is needed.