Guidelines for Working with Core Modules in SuiteCommerce
Understand best practices for working with core modules in SuiteCommerce extensions to ensure compatibility and stability.
TL;DR
When developing extensions for SuiteCommerce websites, it is crucial to avoid direct involvement with core modules to ensure compatibility with future SuiteCommerce updates. Following specific guidelines can help maintain the functionality and stability of your extensions.
Best Practices When Working with Core Modules
When extending SuiteCommerce, it is essential to adhere to specific guidelines to avoid potential problems with future updates or cross-usage with other websites. Here are some best practices:
- Avoid Direct Inclusion: Do not include core modules in a
require()ordefine()statement. - Avoid Extending Core Modules: Refrain from using
extend()to add or overwrite methods or properties of core modules. - No Method Wrapping: Do not use
_.wrap()to modify the output of core module methods. - Prototype Modifications: Avoid modifying the prototype of core modules. Opt for methods such as:
- Use
addChildView()to add a child view instead of usingSomeView.prototype.childViews.MyChildView. - Use
addToViewContextDefinition()for adding properties to a view's context object rather than altering the methodSomeView.prototype.getContext.MyNewProperty.
- Use
Production Code Guidelines
In any production code, the following guidelines should be followed:
- Accessing Private Methods: Use
application.getLayout()to access a core module or object's private methods instead of accessingapplication._layoutInstance. - Avoid Global Variables: Do not access the
SCglobal variable in your extensions. - Use Overrides: Instead of editing core modules directly, always use overrides where necessary.
Following these guidelines will help you create more robust and future-proof extensions in the SuiteCommerce environment, ensuring your development efforts are not undermined by changes in core modules as new versions roll out.
Key Takeaways
- Avoid direct access and modifications to core modules for stability.
- Utilize provided methods like
addChildView()andaddToViewContextDefinition()for modifications. - Use overrides instead of editing core modules directly to maintain compatibility.
- Strictly adhere to guidelines to prevent issues with future SuiteCommerce updates.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Can I directly include SuiteCommerce core modules in my extensions?
How should I add a child view to a core module in SuiteCommerce?
What is the recommended way to modify a view's context object in SuiteCommerce?
Is it okay to access the SC global variable in SuiteCommerce extensions?
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.
