Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
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: