Thursday, October 11, 2018

Use of the Search Operator "anyOf"


The script below shows how to use the search operator "anyOf". The script searches for Customers that has the status of either "Unqualified" or "Renewal". Note that the internal id of the statuses are specified in the array list.

function customerStatus(request,response)
{
   chkStatus = new Array();
   chkStatus[0] = '6'; //Unqualified
   chkStatus[1] = '100'; //Renewal

   var filters = new Array();
   filters[0] = new nlobjSearchFilter('entitystatus', null, 'anyOf', chkStatus, null);

   var searchResults = nlapiSearchRecord('customer', null, filters,null);
   if (searchResults != null){
      response.write(searchResults.length);
   }
}

No comments:

Post a Comment