Creating Custom Views in SuiteCommerce Extensions
Creating custom views enhances SuiteCommerce extensions by defining templates and context for improved presentations.
Creating custom views in SuiteCommerce extensions is essential for enhancing the user interface and optimizing the presentation layer of your application. A view connects user interface events with the necessary data, allowing you to create dynamic experiences in your modules.
Important Note: Starting with SuiteCommerce release 2020.2, the preferred method for developing views is using SCView instead of Backbone.View. This update is vital for maintaining compatibility with the latest SuiteCommerce features.
How to Create a View
Follow these step-by-step instructions to create a new view in your SuiteCommerce extension:
-
Create a New JavaScript File
Within the JavaScript directory of your extension module, create a new file for the view. -
Define the View and Its Template
Use the following structure to define your view and include the associated template file:javascript"text-purple-400">define('MyCoolView', ['Backbone','my_cool.tpl'], "text-purple-400">function (Backbone, my_cool_tpl) { -
Extend Backbone.View
In this step, extendBackbone.Viewto declare your template and context:javascript1{2 "text-purple-400">return Backbone.View.extend({3 template: my_cool_tpl,4 getContext: "text-purple-400">function () {5 "text-purple-400">return {6 name: 'John'7 };8 }9 });10}); -
Save Your View
Ensure that your new view file is saved correctly in the module. -
Update Entry Point JavaScript File
Open the entry point JavaScript file for the module that will utilize your new view. -
Declare Your View as a Dependency
Add your view as a dependency in the entry point file:javascript"text-purple-400">define('MyCoolModule', ['MyCoolView',...], "text-purple-400">function (MyCoolView, ...) { -
Save the Entry Point File After saving your updates, your new view will be ready to use in the module.
-
Declare the View File in the Extension Manifest
Update thejavascriptobject of the application entry points in the extension manifest to include your new view file. This ensures that the view is recognized by the extension. -
Build Associated Templates
Follow best practices for creating any associated templates as detailed in the HTML Best Practices for Themes documentation.
By building custom views, developers can effectively manage variables available in templates, enhancing the overall user experience in their SuiteCommerce extensions.
Key Takeaways
- Creating custom views enhances the user interface in SuiteCommerce extensions.
- Use
SCViewfor extensions developed in SuiteCommerce release 2020.2 or later. - Properly declare views and dependencies for modular JavaScript architecture.
- Follow best practices for template development to optimize performance.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Is SCView mandatory for creating views in SuiteCommerce release 2020.2 or later?
Can I use Backbone.View for creating views in my SuiteCommerce extension?
How should I include my new custom view in the extension manifest?
Do I have to update the entry point JavaScript file after creating a new view?
Was this article helpful?
More in User Interface
- Print to File Feature in NetSuite 2026.1
Print to File in NetSuite 2026.1 enhances document management for efficient mobile printing.
- Open Scanned Vendor Bills in NetSuite 2026.1
Access and manage scanned vendor bills efficiently in NetSuite 2026.1. Learn how to streamline your document management.
- Bill Capture Enhancements in NetSuite 2026.1
Bill Capture enhancements in NetSuite 2026.1 boost efficiency with automated data extraction and improved UI for vendor management.
- On Close Action for X Icon in NetSuite 2026.1
On Close Action for X Icon enhances user experience in NetSuite 2026.1 with customizable popup behaviors.
Advertising
Reach User Interface Professionals
Put your product in front of NetSuite experts who work with User Interface every day.
Sponsor This Category