Create an Entry Point File

The entry point file is necessary to mount your module to the application. This provides the connection between SuiteCommerce Advanced (SCA) and Site Management Tools (SMT). For more information about the architecture and purpose of this file, see Entry Point.

Note:

If you are implementing SCA 2019.2 or later, the entry point file can be a TypeScript or JavaScript file. For more information about TypeScript support, see TypeScript.

To create the entry point file:

  1. In your CCT module’s JavaScript directory, create a new JavaScript (.js) file.

  2. Name this file to intuitively relate to your module.

    JavaScript example:

    ../SC.CCT.ImageViewer@0.0.1/JavaScript/SC.CCT.ImageViewer.js

    TypeScript example:

    ../SC.CCT.ImageViewer@0.0.1/JavaScript/SC.CCT.ImageViewer.ts

  3. Define your entry point dependencies. This includes the view that you create later.

    JavaScript example:

                    define(
       'SC.CCT.ImageViewer'
    ,   [
          'SC.CCT.ImageViewer.View'
       ]
    ,   function (
          SCCCTImageViewerView
       ) 
    
                  

    TypeScript example:

                    /// <amd-module name="SC.CCT.ImageViewer"/>
    
    import SCCCTImageViewerView = require('./SC.CCT.ImageViewer.View'); 
    
                  
  4. Create the mountToApp() method.

    This method is required to initialize your CCT module, making it available to the application. Wrapped inside the mountToApp method is getComponent(‘CMS’).registerCustomContentType(), which passes the id and view variables to SMT:

    • The id variable loads the CMS content type record, connecting your module to the CCT and making your CCT available in SMT.

      Important:

      The value of the id variable must match the Name field of the CMS Content Type record, and it must be all lowercase. See CMS Content Type Record for details.

    • The view variable initializes the view.

    In the following examples, the id variable is ‘sc_cct_imgageviewer’, which matches the CMS content type record’s Name field.

    JavaScript example:

                    {
       'use strict';
    
       //@class SC.CCT.ImageViewer
       return {
          mountToApp: function mountToApp (application)
          {
             application.getComponent('CMS').registerCustomContentType({
                id: 'sc_cct_imgageviewer'
             ,   view: SCCCTImageViewerView
             });
          }
       };
    }); 
    
                  

    TypeScript example:

                    {
       'use strict';
    
       //@class SC.CCT.ImageViewer
    export function mountToApp(application){
             application.getComponent('CMS').registerCustomContentType({
                id: 'sc_cct_imgageviewer'
             ,   view: SCCCTImageViewerView
             });
          }
    }; 
    
                  
  5. Save the file.

Important:

Your SCA source code includes a module named SC.CCT.Html. This module connects your SCA application to the four core CCTs that are included with the SMT SuiteApp. Do not customize or alter the contents of this module.

Related Topics

Create Custom Content Types for SMT
Create a Custom Module for Your CCT
Create a View File
Create a Template File
Set Up Your ns.package.json and distro.json Files

General Notices