Lassi Viitakoski
09/17/2024, 9:06 AMCeligo AI
09/17/2024, 9:06 AMAI generated answer (using internal Slack threads):The error
error.SuiteScriptModuleLoaderError
with UNEXPECTED_ERROR
and syntax error
message is typically caused by a syntax error in your SuiteScript code. In your case, it seems like you are trying to use an arrow function in your SuiteScript 2.1 user event script.
However, it's important to note that as of the current NetSuite version, arrow functions are not supported in SuiteScript 2.1. This is likely the cause of the error you're seeing. Arrow functions are a feature of ECMAScript 6 (ES6), and while SuiteScript 2.1 supports many ES6 features, it does not support all of them, including arrow functions.
In SuiteScript 2.1, you should use the function
keyword to define your functions, rather than using arrow functions. For example, instead of writing const myFunction = () => {...}
, you should write function myFunction() {...}
.
Here's an example of how you might define a callback function in SuiteScript 2.1:
javascript
define(['N/error', 'N/query'], function (error, query) {
function myCallbackFunction() {
// Your code here
}
return {
myCallbackFunction: myCallbackFunction
};
});
Remember to always check your syntax and ensure it is compatible with the version of SuiteScript you are using to avoid such errors.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
09/17/2024, 9:07 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865822196
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865756392
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863271117
Celigo AI
09/17/2024, 9:07 AM