Create an Entry Point JavaScript File

This topic applies to

Applies to

Kilimanjaro

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. For more information on the architecture and purpose of this file, see Entry Point.

To create the entry point:

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

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

    For example:

    ../SC.CCT.ImageViewer@0.0.1/JavaScript/SC.CCT.ImageViewer.js
  3. Define your entry point dependencies.

    This includes the view that you create later. For example, your entry point might look similar to the following:

    define(
       'SC.CCT.ImageViewer'
    ,   [
          'SC.CCT.ImageViewer.View'
       ]
    ,   function (
          SCCCTImageViewerView
       )
  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 Site Management Tools.

      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 example, the id variable is ‘sc_cct_imgageviewer’, which matches the CMS Content Type record’s Name field.

    {
       'use strict';
    
       //@class SC.CCT.ImageViewer
       return {
          mountToApp: function mountToApp (application)
          {
             application.getComponent('CMS').registerCustomContentType({
                id: 'sc_cct_imgageviewer'
             ,   view: SCCCTImageViewerView
             });
          }
       };
    });
  5. Save the JavaScript 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 come with the Site Management Tools SuiteApp. Do not customize or alter the contents of this module.