Discussions
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 );