Entry Point JavaScript Files for Custom Extensions in NetSuite

Create entry point JavaScript files for extensions in NetSuite to integrate modules and enhance application functionality.

·3 min read·View Oracle Docs

Creating entry point JavaScript files is essential for establishing a connection between your custom content types (CCT) and applications in NetSuite. This action enables the module to interact with the larger application framework, facilitating enhancements and features relevant to your business needs.

What Is an Entry Point?

Each extension module contains an entry point that serves as a connection between the extension and the application, crucial for mounting the extension. The entry point functions mainly through a mountToApp() method that initializes the desired module within the application.

Defining Entry Points in the Extension Module

To integrate a custom extension and a custom content type module effectively, follow these steps to create the entry point JavaScript files:

  1. Setting Up the Extension Module:

    • Open the JavaScript file for your extension, for example, Modules/ImageViewerModule/JavaScript/ImageViewerModule.js.
    • Define the dependency on your CCT module using the define function:
      javascript
      "text-purple-400">define(
      'Netsuite.ImageViewer.ImageViewerModule',
      ['NetSuite.ImageViewer.ImageViewerCCT'],
      "text-purple-400">function (ImageViewerCCT) {
    • Implement the mountToApp() function, which calls the CCT module’s mountToApp():
      javascript
      "text-purple-400">return {
      mountToApp: "text-purple-400">function mountToApp (container) {
      ImageViewerCCT.mountToApp(container);
      }
      };
    • Ensure you save your JavaScript file after making these changes.
  2. Creating Entry Point for the CCT Module:

    • Open the corresponding file for the CCT module, Modules/ImageViewerCCT/JavaScript/ImageViewerCCT.js.
    • Add a dependency on ImageViewerCCT.View:
      javascript
      "text-purple-400">define(
      'NetSuite.ImageViewer.ImageViewerCCT',
      ['NetSuite.ImageViewer.ImageViewerCCT.View'],
      "text-purple-400">function (ImageViewerCCTView) {
    • Implement the mountToApp() function similar to the extension module:
      javascript
      1"text-purple-400">return {
      2 mountToApp: "text-purple-400">function mountToApp (container) {
      3 container.getComponent('CMS').registerCustomContentType({
      4 id: 'cct_netsuite_imageviewercct',
      5 view: ImageViewerCCTView,
      6 options: { container: container }
      7 });
      8 }
      9};
    • Remember to save your changes here as well.

Understanding registerCustomContentType Parameters

When using the registerCustomContentType method, ensure that:

VariableDescription
idA lowercase identifier that matches the Name field of the CMS Content Type record within NetSuite.
viewRefers to the ImageViewerCCTView, used for rendering the CCT.
optionsContains additional data for the view’s initialization upon loading.

These configurations allow seamless integration of your custom modules into the NetSuite application, enhancing its overall functionality.

Next Steps

Once you have created the entry points for both the extension baseline and CCT modules, you can proceed to implement view files corresponding to your modules and complete the extension development.

Key Functions to Note:

  • mountToApp(): Central method for integrating custom modules into applications.
  • registerCustomContentType(): Method to register and initialize custom content types within the NetSuite framework.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • Entry points are critical for connecting CCTs to applications in NetSuite.
  • The mountToApp() function is essential for initiating module functionality.
  • Correctly defining dependencies ensures modules interact seamlessly with each other.

Frequently Asked Questions (4)

Are there specific prerequisites required before creating entry point JavaScript files?
The article assumes you have already set up your custom content type and extension modules. You should also be familiar with JavaScript and the `define` function to set up the dependency on your CCT module.
What purpose does the 'mountToApp()' function serve in entry point JavaScript files?
The 'mountToApp()' function is essential for integrating and initializing your custom modules within the NetSuite application. It connects the extension module to the application framework through the extension entry point.
Do I need to include a view dependency when defining the entry point for a CCT module?
Yes, when creating the entry point for a CCT module, you should add a dependency on the associated view, such as 'ImageViewerCCT.View'. This enables rendering and initializing the content type within the application.
Is the 'registerCustomContentType()' method required for every custom content type?
Yes, using 'registerCustomContentType()' is necessary to register and initialize custom content types within the NetSuite framework. It requires parameters including an ID, the view, and additional options for initialization.
Source: Create the Entry Point JavaScript Files Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteCloud Development Framework

View all SuiteCloud Development Framework articles →