For those not familiar with bundle installation scripts, they can be utilized on install and on update of a NetSuite bundle, to handle things such as feature enablement/disablement, data migration, etc. Bundle installation scripts are often used to validate if features are enabled as well.
The contexts under which bundle installation scripts can be utilized are as follows:
1. beforeInstall: executes before bundle is installed in target account
2. afterInstall: executes after bundle is installed in target account
3. beforeUpdate: executes before bundle is updated in target account
4. afterUpdate: executes after bundle is updated in target account
5. beforeUninstall: executes before bundle is uninstalled from target account
Bundle installation scripts allow for a maximum of 10,000 governance units to be consumed per execution.
Not being the most commonly used script type, there are a few issues I’ve run into with bundle installation scripts that are worth mentioning.
1. Non-NetSuite provided modules cannot be used within beforeInstall or afterInstall context. As would be expected, if one attempts to access a file from a local directory during install, any errors encountered will halt the installation process.
2. If certain features are required but not enabled in a target account prior to a bundle installation script running, it can cause the bundle install process to fail. This is why validating whether or not certain features are enabled is oftentimes necessary in a bundle installation script.