Any idea why a Client Script (2.1) attached to a S...
# suitescript
e
Any idea why a Client Script (2.1) attached to a Suitelet would work one day... but not the next? If I set it back to 2.0, it will work but otherwise the scriptContext parameter in the Client Script functions only passes the mode and not the currentRecord.
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * @NScriptName So confused!
 */
define([], function () {

    /**
     * Function to be executed after page is initialized.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
     *
     * @since 2015.2
     */
    function pageInit(scriptContext) {
        console.log('test');
        console.log(scriptContext);
    }

    return {
        pageInit: pageInit
    };

});
When the API Version is set to 2.1, the console prints:
Copy code
'test'
'create'
When the API Version is set to 2.0, the console prints:
Copy code
'test'
Object { currentRecord: {…}, mode: "create" } (as expected)
b
you arent the first to have problems with client script 2.1's parameter
complain to netsuite support
e
It's just so frustrating because it worked yesterday. I wrote 1200 lines of code in ES6 syntax... now I have to rewrite it in ES5
b
but you have to use an embarrassingly low target
e
that's true. would save me a ton of time
Appreciate the input @battk
w
Or start using typescript
💯 1
s
switching 1200 lines from SS2.1 to SS2.0 syntax takes about 10 seconds in TypeScript.