Here is my code: ```/** * @NApiVersion 2.0 * @NS...
# suitescript
j
Here is my code:
Copy code
/**
 * @NApiVersion 2.0
 * @NScriptType ScheduledScript
 */
define(['N/search'],
    /**
 * @param{search} search
 */
    function(search) {

        const execute = function(scriptContext) {

        }

        return {execute}

    });
j
SuiteScript 2.0 doesn't support ECMA6 features, so things like "const" don't work. You'd have to set the NAPIVersion to 2.1 for it to work or change "const" to "var"
c
const does work in 2.0
👍 2
a
function functionName() {}
j
Changing the API version to 2.1 also resolves the error.
👍 1
a
const works, what does not work is mixing es6 style declaration with the old style… Therefore if you remove const execute = and you simply do: function execute(scriptContext) {} then it would work.
👍 1
j
I had to change it to this to get it to work for 2.0: