Friday, June 28, 2019

Search Only Customers but not Leads

NetSuite provides searching feature on customers' records. However, there are more types of customers - Customer, Lead etc. This can be set on each customer in "Status" field.
Searching for customers which have specified status can be done in SuiteScript by using a filter.

Example - Searching for customers which have "Closed Won" status:
1. Go to Setup > Sales > Customer Statuses
2. Get the internal ID of the status (i.e. 13)

The filter code will look like this:
var f = new nlobjSearchFilter('entitystatus',null,'anyof',[13]);

Example - Searching for customers which have "Closed Won" and "In Negotiation" status:
1. Go to Setup > Sales > Customer Statuses
2. Get the internal ID of the statuses (i.e. 13 and 11)

The filter code will look like this:
var f = new nlobjSearchFilter('entitystatus',null,'anyof',[13,11]);

Note: The "Status" field is a list which can be configured under Setup > Sales > Customer Statuses.

Note: For more information about filtering in SuiteScript consult Filtering a Search article.

No comments:

Post a Comment