{"type":"error.SuiteScriptError","name":"UNEXPECTE...
# ask-stanley-ai
b
{"type":"error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":"ReferenceError: \"define\" is not defined. (INVOCATION_WRAPPER
c
AI generated answer (using internal Slack threads):
The error message
ReferenceError: "define" is not defined. (INVOCATION_WRAPPER
typically occurs when you are trying to use SuiteScript modules outside of the entry points in your script. NetSuite does not allow the use of its modules outside of an entry point. In SuiteScript 2.x, the
define
function is used to load modules. If you're seeing this error, it's likely that you're trying to use a module outside of the
define
function's callback, or outside of an entry point function. Here's an example of how to properly use the
define
function to load modules:
Copy code
javascript
define(['N/record', 'N/search'], function(record, search) {
    function myEntryPoint(params) {
        // You can use the record and search modules here
    }

    return {
        execute: myEntryPoint
    };
});
In this example, the
record
and
search
modules are loaded and can be used within the
myEntryPoint
function, which is an entry point for the script. If you're seeing the error
All SuiteScript API Modules are unavailable while executing your define callback
, it's likely that you're trying to use a SuiteScript module outside of an entry point. Make sure that all your SuiteScript code is within an entry point function. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83139658
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829295337
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828114629
Please provide your feedback on this answer.