Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
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: