BeforeUndeploy Hook
The beforeUndeploy hook lets you run SuiteScript logic before your SuiteApp is uninstalled from an account. This hook is useful for performing cleanup tasks, such as deleting custom objects, files, or folders.
You can define this hook in the application.xml file using one or more SDF installation scripts.
Defining the beforeUndeploy Hook
To define this hook, add a <beforeUndeploy> section to your project's application.xml file within the <hooks> element. This section contains one or more <script> entries, each indicating a script that should run automatically before the SuiteApp is uninstalled.
Each <script> entry must include:
-
<path>- The file path to the SDF installation script object. -
<deployment>- The script deployment ID that should run during uninstall.
Your application.xml should look similar to the following:
<application>
<hooks>
<beforeUndeploy>
<script>
<path>~/Objects/customscript_spainlocalization_installer1.xml</path>
<deployment>customdeploy_spainlocalization_installer1</deployment>
</script>
<script>
<path>~/Objects/customscript_spainlocalization_installer2.xml</path>
<deployment>customdeploy_spainlocalization_installer2</deployment>
</script>
</beforeUndeploy>
</hooks>
</application>