Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
contact search filter issue
Hi,
Do you have a working server script for searching contacts for a given customer?
I am having trouble getting a filter object to restrict the search by company. The search is not working with a filter, however is working without the filter. Any ideas why this would happen? Function code below.
Any help will be much appreciated.
function searchContacts( customer )
{
var internalid = customer.getId();
var filter = new Array();
filter[0] = new nlobjSearchFilter( "company", null, "anyof", internalid, null );
if( filter[0] != null )
{
var sr = nlapiSearchRecord( 'contact', null, filter, null );
if( sr != null )
{
if( sr.length > 0 )
{
nlapiLogExecution('DEBUG', 'SearchContact results-', sr.length );