0
votes

I have a simple custom module which posts messages to a server-side Suitelet.

/**
 * test_app_client_module.js
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */

define(['N/ui/message'], function(message) {

    var exports = {};

    function showMessage(messageObject) {
        message.create(messageObject).show();
    };
    
    exports.showMessage = showMessage;

    return exports;

});

This module functions properly when used with form.ClientScriptModulePath and invoked from a file cabinet, excluding @NScriptType.

However, if I attempt to create a script record to define this module in a remote function, I get the following error.

SuiteScript 2.0 entry point scripts must implement one script type function.

Any suggestions?

1
If you create a module you don't need to specify the @NScriptType. A module is a file that is called in a script(suitelet, clinet etc or in a module) using define or require. - fullstack.studio

1 Answers

0
votes

As the error message states, you haven't implemented an entry point function. All Script modules need at least one entry point.

Add an empty pageInit function to your module.

exports.pageInit = function () {}