Reputation: 927
I can search customer records using below script. This was working fine.
require(['N/search'])
search = require('N/search')
var options = {
type: "customer"
};
options.columns = ["companyname", "firstname", "middlename", "lastname"];
var customerSearch = search.create(options);
var results = customerSearch.run({
}).getRange({
start: 0,
end: 5
});
log.debug(results)
I get result as list of customer, lead, prospect & job.
Why I get lead, prospect & job records while searching customer?
How to get customer type records alone while searching?
Upvotes: 0
Views: 1106
Reputation: 15462
You get this because all of those are 'stages' of the customer process.
You need to add a filter:
options.filters = [['stage', 'anyof', ['CUSTOMER']]];
Upvotes: 3