Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
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 );