Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
SuiteScript 2.1 error SUITESCRIPT_API_UNAVAILABLE_IN_DEFINE
I have started creating some SS 2.1 API scripts and came across an error I haven't seen documented anywhere yet.
Most of my existing scripts are defined as API version 2.x, so they continue to be executed as if they were 2.0 (until 2021.1 release as I understand).
Some of those scripts are custom modules that I load into other scripts, here is an example:
/**
* @NApiVersion 2.x
*/
define(['N/config'], function (config) {
var preferences;
function load() {
if (!preferences)
preferences = JSON.parse(config.load({ type: config.Type.COMPANY_PREFERENCES }).getValue({ fieldId: 'custscript_preferences' }));
return preferences;
}
return {
load: load,
};
});
Below is how I'm attempting to use the module in a SS 2.1 User Event script: