Patch Using Extend Mode

This topic applies to

Applies to

SuiteCommerce Advanced

If you want to implement a patch that corrects an issue by extending a property, object, or method, follow the steps in this procedure. You can access the instructions for each patch from a list provided in Patch Instructions.


Before proceeding, familiarize yourself with Best Practices for Customizing SuiteCommerce Advanced.

Step 1: Develop An Extension

  1. Open the Modules directory in your local development environment.

  2. Create an extensions directory where you can store your custom module. Depending on your implementation, this directory might already exist.

  3. Within the extensions directory, create a subdirectory with a name similar to the module you need to customize.

    A good pattern to follow is: Modules/extensions/<module_name>Extension@<extension_version>

    For example, If you need to patch the CMSadapter module, name your subdirectory: CMSadapterExtension@1.0.0.

  4. Open the custom module subdirectory from the preceding step and create a new subdirectory with a name that reflects the type of file you need to patch. Possible types include: JavaScript, SuiteScript, Configuration, Sass, Template.

    For example: Modules/extensions/CMSadapterExtension@1.0.0/JavaScript

  5. In the subdirectory from the preceding step, create a file that includes the code needed for your extension.

    Name this file according to best practices.

    For example: CMSadapter.Component.Extension.js

  6. Open the file and extend the property, object, or method by copy-pasting the code sample included in your patch instructions.

  7. Save the file.

Step 2: Prepare the Developer Tools For Your Patch

  1. Open the custom module directory you created in the first part of this procedure. For example, if you are extending the CMSadapter module, open the CMSadapterExtension@1.0.0 directory.

  2. Create a file in the custom module directory named ns.package.json.

    For example : Modules/extensions/CMSadapterExtension@1.0.0/ns.package.json

  3. Paste the code provided in your patch instructions into the new ns.package.json file.

    The provided code is specific to the file type for your extension.

  4. In the top level of the SuiteCommerce Advanced directory, open the distro.json file.

  5. Add your extension to the modules object in the distro.json file.

    Add your extension to the list of existing values that follow the “modules”: key as shown in the following example.


    Values for other keys in the modules object are release-specific and so the following example may not look exactly like the object in your distro.json file.

    { "name": "SuiteCommerce Advanced Kilimanjaro", "version": "2.0", "isSCA": true, "buildToolsVersion": "1.3.1", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "extensionsModules": "Modules/extensions", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/CMSadapterExtension": "1.0.0", "extensions/MyExampleCartExtension1": "1.0.0", ...

    This step ensures that the Gulp tasks include your extension when you deploy. In the preceding example, extensions have been added at the beginning of the list of modules. However, you can add your extension anywhere in the list of existing values. The order of precedence in this list does not matter.

  6. You may need to add your custom extension as a dependency to the starters of the required applications.

    See your patch instructions for details.

  7. Save the distro.json file.

Step 3: Test and Deploy Your Patch

How you test and deploy depends on your patch.

  • If your patch extends a SuiteScript file, deploy the source code to NetSuite to test the functionality. See Deploy to NetSuite for details. SuiteScript files run on the server and must be deployed to NetSuite to take effect.

  • For extensions to file types other than SuiteScript, you can test your source code on a local server or deploy to your NetSuite account. See SCA on a Local Server or Deploy to NetSuite for details.