Setting Up a Bundle Installation Script

Complete the following steps to set up a bundle installation script.

Create the Bundle Installation Script File

Create a .js script file and add code. This single script file should include Before Install, After Install, Before Update, After Update, and Before Uninstall functions as necessary. It can include calls to functions in other files, but you will need to list these files as library script files on the NetSuite script record.

Add the Bundle Installation Script File to the File Cabinet

  1. Go to Documents > Files > File Cabinet, and select the folder where you want to add the file.

    You should add your file to the SuiteScripts folder, but it can be added to any other folder of your choice.

  2. Click Add File, and browse to the .js file.

  3. In the File Cabinet folder where you added the bundle installation script file, click the Edit link next to file.

  4. Check the Available for SuiteBundles box.

  5. Optionally, you can check the Hide in SuiteBundle box.

    Because this script file will be included in the bundle, by default its contents will be accessible to users of target accounts where the bundle is installed. If you do not want these users to see this file, you can set this option to hide it.

  6. Click Save.

Create the Bundle Installation Script Record

  1. Go to Setup > Customization > Scripts > New, and click Bundle Installation.

  2. Complete fields in the script record and save.

    Although you do not need to set every field on the Script record, at a minimum you must provide a Name for the Script record, load your SuiteScript file to the record, and specify at least one of the executing functions on the Scripts tab.

    Entry points on Script page for bundle installation script.
  3. These functions should all be in the main script file. If these functions call functions in other script files, you need to list those files as library script files.

Define Bundle Installation Script Deployment

  1. Do one of the following:

    • When you save your Script record, you can immediately create a Script Deployment record by selecting Save and Deploy from the Script record Save button.

    • If you clicked Save, immediately afterwards you can click Deploy Script on the script record.

    • If you want to update a deployment that already exists, go to Customization > Scripting > Script Deployments. Click Edit next to the deployment record you want to edit.

  2. Complete fields in the script deployment record and click Save.

    Be sure to check the Execute as Admin box.

    If you want to debug the script, set the Status to Testing. To enable the script to be run in a target account, you must set the Status to Released.

Associate the Script with a Bundle

Note:

The SuiteBundler feature must be enabled in your account for you to have access to the Bundle Builder where this task is completed.

  1. Start the Bundle Builder.

    • If you are creating a new bundle, go to Customization > SuiteBuilder > Create Bundle.

    • If you are editing an existing bundle, go to Customization > SuiteBundler > Search & Install Bundles > List, and select Edit from the Action menu for the desired bundle.

  2. On the Bundle Basics page, select a bundle installation script deployment from the Installation Script dropdown list.

  3. Proceed through the remaining Bundle Builder steps, making definitions as necessary, and click Save. Note the following:

    • On the 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.

    • After the bundle has been saved, this script record and related file(s) are listed as Bundle Components on the Bundle Details page.

      Bundle components on the Bundle Details page.

Related Topics

SuiteScript 2.x Bundle Installation Script Type
SuiteScript 2.x Bundle Installation Script Entry Points

General Notices