Using Bundle Installation Scripts
Each bundle can include a specialized server SuiteScript that is automatically run when the bundle is installed, updated, or uninstalled. A bundle installation script can contain triggers to be executed before install, after install, before update, after update, or before uninstall. This trigger code can ensure that bundles are implemented and removed correctly and efficiently, and can prevent bundle installation, update, or uninstall if proper setup has not occurred. Note that this type of script can be run in any target account where the associated bundle is installed, even if scripting features are not enabled in that account.
To associate a bundle installation script with your bundle, you need to create the script .js file, upload the script file to the NetSuite File Cabinet, create a script record, and define one or more deployments for the script.
After a bundle installation script has been created and at least one deployment has been defined for it, you can associate the script with a bundle by selecting from the Installation Script list on the Step 1 Bundle Basics page. A single bundle installation script can be associated with multiple bundles. When you associate a script with a bundle, you select a specific script deployment.
Detailed documentation about bundle installation scripts is available in the SuiteScript section of the Help Center:
-
For step-by-step instructions for developing bundle installation scripts and associating them with bundles, see the SuiteScript help topic Setting Up a Bundle Installation Script.
-
For more details about bundle installation scripts, see the SuiteScript help topic SuiteScript 2.x Bundle Installation Script Type.
-
To review a sample script, see Bundle Installation Script Sample.
On the Step 3 Select Objects page of the Bundle Builder, you do not have to explicitly add the bundle installation script. This script record and the related .js file are included automatically in the bundle, as are any other .js files that are listed as library script files on the script record.
Related Topics
- Bundle Builder Reference
- Hiding Bundle Components in Target Accounts
- Bundle Support during NetSuite Release Phasing
- Documenting a Bundle
- Defining Bundle Terms of Service
- Protecting Your Bundled Server SuiteScripts
- File and Folder Management in Bundles
- Bundling NetSuite Financial Statements
- Bundle Object Preferences
- Locking Objects in Customization Bundles
- Creating a Bundle with the Bundle Builder
- SuiteScript 1.0 Documentation
- SuiteScript 1.0 Documentation
- Setting Up a Bundle Installation Script
- SuiteScript 1.0 Documentation
- SuiteApps and Sandbox Accounts