Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Advanced extensibility through stereotype scripts and script items > Troubleshooting > I cannot undo changes made by my script
  
I cannot undo changes made by my script
The scripts provide special functions that allow you to make changes to the model through a transaction.
If you cannot undo the changes made by a script, the script that is making changes to the model is not within a special function.
To resolve this problem, locate the script that is making changes to the model, and move that script to within the special function that is appropriate for the script type. The functions that make changes to a model through a transaction are as follows:
For Diagram Toolbar Scripts—use the OnFinished script function. For more information, click a topic below.
Script functions, attributes and objects - diagram toolbar button script for adding links
Script functions, attributes and objects - diagram toolbar button script for adding nodes
Script functions, attributes and objects - overview
Script template for diagram toolbar button scripts for links
Script template for diagram toolbar button scripts for nodes
For Double-Click Scripts—use the CommitDoubleClick script function. For more information, click here.
For Menu Command Scripts—use the CommitMenu and AfterMenuCommit script function. For more information, click here.
For On Drop Scripts—use the OnDrop script function. For more information, click a topic below.
Script functions, attributes and objects - on drop scripts for diagrams
Script functions, attributes and objects - on drop scripts for items
Script functions, attributes and objects - overview
Script template for on drop scripts for diagrams
Script template for on drop scripts for items
For Utility Scripts—use the CommitUtility script function. For more information click here.
Making changes to the model through the preceding functions also minimizes disruption to other users because of item locking. In addition, you can see the changes made by the script without having to refresh your Modeler views.
* 
On Delete and Derivation Script scripts do not have any functions specifically for making changes to the model.