Sorry for the newb question, but I am having some ...
# suitescript
d
Sorry for the newb question, but I am having some issues getting SS2.0 working through console. I am setting my search var as such
Copy code
var search = require(["N/search"]);
however, when I go to execute a query I am receiving the following response on console
Copy code
Uncaught TypeError: search.create is not a function
. The code I am trying to execute is
Copy code
var result = search.create({type: "itemvendor", columns: ["vendor"]});
b
the require used by NetSuite is the amd version. First parameter is an array of modules ids, second parameter is a function whose arguments are the modules requested by the first.
you want to use something like
Copy code
require(["N/search"], function(search) {
  var searchObject = search.create({
    type: "vendor",
    columns: [{ name: "entityid" }]
  });
  var resultSet = searchObject.run();
  var searchResults = resultSet.getRange({ start: 0, end: 1000 });
  console.log(searchResults);
});
d
I was under the impression there was a way to do more step testing in the console without having to define the call back function
b
you can do what @jarens suggests. It allows you to only use require once.
s
you can simply just do
Copy code
require(['N/record']);
var record = require('N/record');
to use the singular modules, not as lengthy as the other method
n
@David Durst Yu might want to spend a few minutes on:

https://www.youtube.com/watch?v=ZAN8clhKxIw▾

and thank @erictgrubaugh afterward.