Testing Extensions on a Local Server in NetSuite
Test your extensions on a local server before deployment with Gulp.js, ensuring seamless integration and functionality.
You can test your extension customizations on a local server before deploying to NetSuite. This local server is installed as part of the Node.js setup and utilizes the Express web framework.
Setting Up Your Local Server
To start testing your extension locally, execute the following command in your terminal:
gulp extension:localThis command compiles all source files and places them into the combined files located within the LocalDistribution/tmp directory. When the server starts, Gulp.js initializes watch tasks that monitor changes made to your files, such as JavaScript, Templates, or Sass directories. As you save changes, Gulp automatically recompiles the necessary files and updates the LocalDistribution directory, while also notifying you in the console of any changes.
Important: Typically, you should test your code locally before deployment to a live NetSuite account. However, if your extension includes SuiteScript or configuration files (JSON), you must deploy these files to your account and activate the extension for local server access to them. Services added through SuiteScript won’t be available in your account's backend until deployed, and changes to configuration JSON files require deployment to apply.
Steps to Test Your Extension
Follow these steps to test your extension on a local server:
-
Fetch the Active Theme: Ensure you fetch the active theme before testing your extension. This is crucial for proper functionality. Refer to the Fetch Active Theme and Extension Files for detailed instructions.
-
Open Command Line: Access the top-level development directory created after extracting the Extension Developer Tools.
-
Run Gulp Command: Execute:
bashgulp extension:localThis initializes your local server and compiles your source files for the first time, creating a
LocalDistributionsubdirectory if it doesn't already exist.Warning: Running
gulp extension:localwill overwrite yourmanifest.jsonfile with default changes. To avoid data loss, use the command:bashgulp extension:local --preserve-manifest…to keep your manual modifications intact.
-
Access Local Application: Navigate to your local application using one of the following URL patterns, ensuring you replace placeholders appropriately:
-
Shopping:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/<_SSP_APPLICATION_>/shopping-local.ssp -
My Account:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/_SSP_APPLICATION_/my_account-local.ssp -
Checkout:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/_SSP_APPLICATION_/checkout-local.ssp -
Example for SuiteCommerce:
http://www.mysite.com/c.123456/scs/shopping-local.ssp
-
Example for SuiteCommerce Advanced:
http://www.mysite.com/c.123456/sca-dev-aconcagua/shopping-local.ssp
-
Note: For secure HTTPS checkout access, refer to Secure HTTP (HTTPS) with the Local Server for specifics.
Conclusion
By following these steps, you can effectively test and debug your extension on a local server, ensuring that it functions correctly before deploying it to a live environment. Always be mindful of potential data loss when updating manifest files.
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- Test extensions locally to validate functionality before deployment.
- Use Gulp.js to compile and manage code changes effectively.
- Ensure you fetch the active theme and deploy your extension correctly to access all features.
Frequently Asked Questions (4)
What command should I use to test my NetSuite extension locally?
How can I preserve manual changes in my manifest.json file when testing locally?
Do I need to deploy SuiteScript files to test them locally?
What is important to do before testing an extension locally on NetSuite?
Was this article helpful?
More in Commerce
- Available Items Only Feature in NetSuite 2026.1
Available items only filtering boosts sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
- Commerce Extensions in NetSuite 2026.1
Commerce Extensions in NetSuite 2026.1 enhance performance and user experience in eCommerce.
- Convert Multiple Transaction Line Items into Configured Items in
Enhance transaction processing in NetSuite by converting multiple line items into configured items with improved session handling.
- New SuiteCommerce Features in NetSuite 2026.1
New SuiteCommerce features in NetSuite 2026.1 enhance user experience and improve eCommerce efficiency.
