Applies To
Product: NetSuite 2022.1
Scenario
User is encountering the error above after executing a SuiteScript 2.0 and the said function was executed.
Solution
One of the known reasons for this is that inside the script, the define and function is not properly arranged or not named properly. And due to that the function being called is not existing on the said module.
Below is a sample script that will cause the error:
define(['N/record', 'N/email', 'N/search', 'N/runtime'],
function(search, runtime, email, record) {
var failedOrderLoad = runtime.getCurrentScript();
});
Copy
Noticed that the parameter “runtime” is aligned with the “N/email” module. With that, N/email module is being called when the runtime name is used instead of N/runtime module.
Below is a sample of the proper scripting:
define(['N/record', 'N/email', 'N/search', 'N/runtime'],
function (record, email, search, runtime) {
var failedOrderLoad = runtime.getCurrentScript();
});