How to force NetSuite to “get” a script’s API version (2.x -> 2.1) update?
Hi all,
We’ve updated all the scripts in the SuiteApp we’re developing to 2.1 syntax recently – and changed the @NApiVersion JSDoc tag in the script files accordingly: from 2.x to 2.1.
However, on releasing this, we get reports from customers who claim that when they upgrade, NetSuite UI continues showing 2.0 as the API VERSION on the Customization -> Scripting -> Scripts page, for at least some of the scripts (as in the screenshot below). What’s worse, this causes NetSuite to throw an error whenever a 2.1 syntax is encountered in one of them, essentially making our SuiteApp unusable…
We’re quite baffled over this, and can’t reproduce the behavior in our testing accounts. Would anyone know what may be causing this, if there’s any setting to check, or how to remedy the situation? Our suspicion so far goes in the direction of an internal NetSuite bug.
Thanks!
If anyone else encounters this really strange error, this is how we ended up fixing it: for each script affected by this, we went to its XML “script object” file (as described e.g. here: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_160321147201.html) and changed the scriptid attribute. This also forces a rename of the XML file, as they need to be equal (besides the .xml file extension). Note that you may have some references to the scriptid in the code as well (grep the codebase to find out) – these obviously need a rename too.
We think this remediates the issue because NetSuite treats such a rename as one script being deleted and another one being created – and since the one “being created” has @NApiVersion 2.1 from the start – it finally “gets” it. Phew…
I ran into this same irritating issue and the workaround propsed by @jzankowski didn’t work. As a long shot, I removed all the code form the file and just left a bare-bones script shell like this (TypeScript) and it solved the issue. I then pasted back in my actual code, updated the file in the File Cabinet and NetSuite help the 2.1 API version. Oh NetSuite….
Update: Is this site really being maintained anymore? The formatted code looks like garbage, removes whitespace and truncates the last line. Then the “Share” link shows html source. I’m using FireFox.
/**
* Company xxxxxxx
* Description xxxxxxx
* Note: JavaScript is transpiled from TypeScript source xxxxxxxx.ts
*
* ScriptId xxxxx
* DeploymentId xxxxx
*
*
* @NApiVersion 2.1
* @NScriptType scheduledscript
**/
namespace NV {
export function execute () {
}
}
export = {
execute: NV.execute,
}





