Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Advanced extensibility through stereotype scripts and script items > Extending delete behavior through stereotypes and scripts > Changing delete behavior through a script
  
Changing delete behavior through a script
Typically, you will want to create Scripts within a profile Package.
To change delete behavior through a script:
1. Right-click the profile Package, point to New, point to UML, point to Profiles, and then click Script
2. Type a name for the Script, and then press the Enter key.
3. Open the Script's Property Pages, and then click the Items tab.
4. Click the Link button, select the item and diagram types for which you want to apply the on delete script, and then click OK
5. Click the Settings tab.
6. In the Script Type list, select OnDelete
7. Click the Script tab.
8. In the box, type the script you want to run when an item is going to be deleted.
If you want to change the text in a larger window with the Text Format Toolbar available, click the Editor button.
For more information about working with scripts,
a. Script functions, attributes and objects - on delete scripts
b. Script functions, attributes and objects - overview
c. Script template for on delete scripts
The script will be run whenever a valid item or diagram is going to be deleted.