Baseline Extension Creation for SuiteCommerce Development
Creating a baseline extension in SuiteCommerce involves generating a structured workspace, including assets and essential configuration files.
Creating a baseline extension in SuiteCommerce provides developers with a structured environment to build their custom extensions. By executing the gulp extension:create command, essential directories, files, and modules are automatically generated, streamlining the development process.
What Happens When You Create a Baseline Extension?
When you run the gulp extension:create command, the extension developer tools perform several key actions:
- Creates the Workspace directory in your top-level development directory, unless it already exists.
- Creates a subdirectory named after your extension, which contains all assets and the initial module.
- Generates a manifest.json file, holding all necessary information required to compile resources for your extension.
Example Directory Structure
For example, if you create an extension named MyCoolExtension with a vendor name of Acme and an initial module named MyCoolModule, your Workspace directory may look like this:
1Workspace/2 MyCoolExtension/3 assets/4 fonts/5 img/6 services/7 Modules/8 MyCoolModule/9 Configuration/10 JavaScript/11 Sass/12 SuiteScript/13 SuiteScript2/14 Templates/15 manifest.jsonStarter Files
The developer tools also generate starter files in various categories, such as Configuration, JavaScript, Sass, and Templates. The aim is to create a fundamental 'Hello World' extension example. Adjustments may be needed based on SuiteCommerce versions you are utilizing:
- Model Files: The file
Acme.MyCoolExension.MyCoolModule.Model.jsserves as the frontend model. If your development targets SuiteCommerce or SuiteCommerce Advanced 2020.1 or later, you might need to update thegetAbsoluteUrlmethod as specified in related guidelines. - View Files: The file
MyCoolModule.Model.View.jshandles the user interface. When developing for SuiteCommerce Advanced versions prior to 2020.1.0, you'll refer to legacy documentation concerning views. For versions 2020.2.0 and later, the recommended practice is to utilize the SCView class instead of Backbone.View.
Using SuiteScript 2.0 Services
During the creation of your extension, the developer tools set up a frontend model that supports requests via backend services. The model utilizes the getAbsoluteUrl method to determine the correct service URL, essential for communication with the backend. When utilizing this method, you must specify:
- The relative service path.
- A boolean value indicating whether the URL is for a SuiteScript 2.0 service (set to
true) or for a SuiteScript 1.0 backend service (set tofalse).
Note: You will need to create separate models for multiple services within your extension. Reusing the initially created model file and modifying it for other services is advisable.
Important Example Code for Service Models
- SuiteScript 1.0 service:
//@property {String} urlRoot urlRoot: Utils.getAbsoluteUrl( getExtensionAssetsPath("services/MyCoolModule.Service.ss") );- SuiteScript 2.0 service:
1//@property {String} urlRoot2 urlRoot: Utils.getAbsoluteUrl(3 getExtensionAssetsPath(4 "Modules/MyCoolModule/SuiteScript2/MyCoolModule.Service.ss"5 ),6 true7 );Understanding these structures and methods is crucial for successfully developing and deploying an effective SuiteCommerce extension.
Frequently Asked Questions (4)
How do I initiate the creation of a baseline extension in SuiteCommerce?
What initial file structure is created when using gulp to make a baseline extension?
Are there specific version considerations for model files in SuiteCommerce?
How are SuiteScript services structured in a baseline extension?
Was this article helpful?
More in General
- Field Service Management Enhancements and Bug Fixes for 2026
Overview of the 2026 Field Service Management SuiteApp updates showcasing enhancements and bug fixes.
- Integrating NetSuite Connector with Shopify: Setup Guide
Integrate your NetSuite Connector with Shopify seamlessly by following this setup guide, including key authorization steps.
- Example
Documentation article about Example
- Testing Fulfillment and Product Sync in NetSuite Connector
Manual procedures for testing order, fulfillment, price, quantity, and full product sync processes in NetSuite Connector.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category