Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Search not working when using two custom fields
I have two entity custom fields set up as free text fields. Each of them contain a default value when a customer is created.
This works when there's one custom field, but not two:
[PHP]
$itemSearch = new nsComplexObject("CustomerSearchBasic");
$itemSearch->setFields(array("email" => array( "operator" => "contains", "searchValue" => 'test@test.com')));
$myNSclient->setSearchPreferences(false, 10);
$searchResponse = $myNSclient->search($itemSearch);
if (!$searchResponse->isSuccess) {
echo "<font color='red'>" . $searchResponse->statusDetail[0]->message . "</font>";
} else {
echo "<font color='green'><b> - Found $searchResponse->totalRecords records</b></font>";
This works when there's one custom field, but not two:
[PHP]
$itemSearch = new nsComplexObject("CustomerSearchBasic");
$itemSearch->setFields(array("email" => array( "operator" => "contains", "searchValue" => 'test@test.com')));
$myNSclient->setSearchPreferences(false, 10);
$searchResponse = $myNSclient->search($itemSearch);
if (!$searchResponse->isSuccess) {
echo "<font color='red'>" . $searchResponse->statusDetail[0]->message . "</font>";
} else {
echo "<font color='green'><b> - Found $searchResponse->totalRecords records</b></font>";
0