Can't create a Sales Order in Dynamic mode SuiteScript 2.1

Viewed 33

I've hit a bit of a wall with this one.

I'm trying to create a Sales Order using SuiteScript 2.1 and it's failing at the record create function.

I'm almost certain the syntax is right but I'm wondering if there's an environment issue or maybe it's just the debugger.

When I run the below code in Script Debugger using 2.1 I get the following error

require(['N/currency', 'N/record', 'N/search'],

    function (currency, record, search) {

        var salesOrder = record.create({
            type: record.Type.SALES_ORDER,
            isDynamic: true
        })
})
Exception: TypeError TypeError: r is not a function

If I run it in 2.0 it works fine. If I create it in standard mode it also works fine.

I'm starting to wonder if the debugger is buggy!?

Any thoughts would be much appreciated.

Thanks in advance!

UPDATE:

Just testing this by publishing the script and it runs fine. Seems to be an issue with the debugger!

Has anyone else had this sort of issue?

1 Answers

SuiteScript 2.1 is not supported in the legacy debugger. You need to use the new "2.1 Script Debugger" in Chrome DevTools. See this SuiteAnswers article (NetSuite login required) especially the excerpt below:

Important

You cannot use the SuiteScript Debugger to debug SuiteScript 2.1 scripts. You can still test critical parts of your script in the SuiteScript Debugger as a SuiteScript 2.0 script before you run the script as a SuiteScript 2.1 script. For more information about SuiteScript 2.1, see SuiteScript 2.1.

Related