简体   繁体   中英

How to debug SuiteScript 2.0 (RESTlet) in NetSuite Debugger?

I am trying to debug sample suitescript (2.0) in Netsuite Debugger, but getting error:

TypeError: Cannot read property "length" from undefined (SYSTEM_LIBS$debugger.sys#2372)

var SEARCHMODULE;
 /**
 *@NApiVersion 2.x
 *@NScriptType Restlet
 *@NModuleScope Public
 */
var func = require(['N/search'],
    function (search)
    {
        function func1(context)
        {
            SEARCHMODULE = search;
            log.debug('Called from POST', restletBody);
          var mySearch = SEARCHMODULE.create({
            type: SEARCHMODULE.Type.CUSTOMER,
          columns: ['entityid']

        });

        var res = SEARCHMODULE.run();
        }
        function func2(context)
        {
           // add your logic here 
        }

        return {
            post: func1,
            get: func2

        };
    });

func();

I think, I am missing some code pattern here. Can please anybody help me regarding this.

Thanks in advance

Change:

var res = SEARCHMODULE.run();

to:

var res = mySearch.run();

Also, put the line inside the function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM