Bundle Themes and Extensions as SuiteApps

This topic applies to

Applies to

SuiteCommerce Web Stores

To bundle SuiteCommerce themes and extensions, follow these steps:

Step 1: Prepare Themes and Extensions for Bundling

The first step is to prepare any folders containing your themes or extensions to enable bundling.

To prepare your theme or extension for bundling:

  1. In your NetSuite File Cabinet, navigate to the folder containing your theme or extension. This folder is the one containing your theme and extension files, including the manifest.json file. For example:

    SuiteScript/Deploy_Extensions/<VendorName>/<ThemeOrExtensionName>@<Version>/
  2. Click edit next to the extension folder you are including in the bundle.

  3. In the Document Folder record, check the Available for SuiteBundles option.

  4. Click Save.

  5. Repeat this for every theme and extension you want to include in a SuiteApp.

    You are now ready to create an installation script.

Step 2: Create a Unique Installation Script for Your Theme or Extension SuiteApp

Before bundling your themes or extensions as a SuiteApp, you must complete the following steps:

  1. Create an installation scrip file.

  2. Create an Installation Script record.

  3. Deploy your installation script.

A bundle installation script is essential to allow SuiteApp installation, update, and uninstallation processes to run properly. The SuiteCommerce Extension Management SuiteApp comes with a default bundle installation script that you can use, titled: ExtensionBundle.js. As a best practice, copy the default file to create a unique script for each SuiteApp you want to build.

Important

Never edit the default ExtensionBundle.js file directly. As a best practice, create a unique installation script file for each theme or extension SuiteApp you want to build, even if you do not include any customizations. Store your installation scripts in a location associated with your theme and extension files.


This default script includes the necessary functions to install, update, or uninstall the SuiteApp and its contents. This includes the following trigger functions:

  • beforeInstall

  • afterInstall

  • afterUpdate

  • beforeUninstall

Note

You only need one installation script per SuiteApp. The script applies to any included themes and extensions.


To create an installation script file:

  1. In the NetSuite File Cabinet, browse to SuiteBundles/Bundle xxxxxx, where xxxxxx equals the Bundle ID of the SuiteCommerce Extension Management SuiteApp.

    See Install Your SuiteCommerce Application for the latest Bundle ID of the SuiteCommerce Extension Management SuiteApp.

  2. Make a copy of the default ExtensionBundle.js file:

    1. Click Copy Files.

    2. Expand the Filters area.

    3. In the Copy To list, select a location in the File Cabinet to store your copy.

    4. Check the box next to ExtensionBundle.js.

    5. Click Copy.

    6. Rename your new file as needed. (Optional)

      To rename a file, navigate to its location and edit the file record.

  3. Edit your new installation script file to meet your needs (optional).

    The default script can handle most requirements. However, if you have custom needs or want to make special validations or operations in NetSuite records, you can edit the script to meet your needs. For specific information and instructions regarding installation script files, see the help topic SuiteScript 2.0 Bundle Installation Script Type.

    Important

    If you need to edit ExtensionBundle.js, maintain the validations and operations that came with default file.


    Note

    The ExtensionBundle.js file that comes with the 18.2 release of the SuiteCommerce Extension Management SuiteApp support updates. However, if you previously created an extension as a SuiteApp prior to the 18.2 release, we recommend recreating the SuiteApp with the latest update to take advantage of the version management functionality. This includes creating a new installation script with SuiteScript 2.0.


To create an Installation Script record:

  1. Go to Customization > Scripting > Scripts > New.

  2. In the Script File field, click List.

  3. In the -All- list, scroll to select the location of your installation script (this is your copy of ExtensionBundle.js).

  4. Select your installation script from the list.

  5. Click Create Script Record.

  6. From the Select Script Type list, select Bundle Installation.

  7. In the new Script record, name your bundle and provide a description (optional).

  8. In the Scripts tab, confirm that the following script fields populated correctly.

    • Before Install Function: beforeInstall

    • After Install Function: afterInstall

    • After Update Function: afterUpdate

    • Before Uninstall Function: beforeUninstall

  9. Click Save.

To deploy your installation script:

  1. Create a Script Deployment. See the help topic Steps for Defining a Script Deployment.

  2. Name your script and provide an ID, beginning with underscore (_).

  3. Set the Status field to Released.

    Important

    Failure to set this field to Released results in a failed installation.


  4. Choose the Log Level to meet your needs.

  5. When you have finished, click Save.

    You are now ready to create your SuiteApp.

Step 3: Create the SuiteApp for Your Themes or Extensions

After you have successfully created and deployed your installation script, you are ready to build your SuiteApp. Follow the instructions detailed in Creating a Bundle with the Bundle Builder.

Observe the following information when building a SuiteApp for SuiteCommerce themes and extensions:

  • When choosing the installation script, select the script you created earlier.

  • You cannot use the same Installation Script record across multiple SuiteApps when bundling SuiteCommerce themes or extensions. You must select a unique Installation Script record for each SuiteApp.

  • When prompted to select objects for the SuiteApp, browse to File Cabinet/Folders and choose the objects associated with each theme or extension you are including in your SuiteApp. Look for the objects that match your deployed themes and extensions.

  • You can create theme and extension SuiteApps as managed or unmanaged bundles.

  • You can bundle any number of themes and extensions within one SuiteApp.