2

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

user2626026
  • 21
  • 3
  • 8

1 Answers1

0

Change:

var res = SEARCHMODULE.run();

to:

var res = mySearch.run();

Also, put the line inside the function