1

我正在尝试通过电子邮件搜索客户。Netsuite api 文档没有多大帮助。感谢我能得到的任何帮助。谢谢你。

    global $myNSclient;
$email = "myemail";
$item = new nsComplexObject('SearchStringField');
$item->setFields(array( 'searchValue' => $email, 'operator' => 'is'));
$search = new nsComplexObject('ContactSearchBasic');
$search->setFields($item);
$myNSclient->setSearchPreferences(false, 10);
$searchResponse = $myNSclient->search($search);
4

2 回答 2

1

我有很多白发试图自己解决这个问题。

下面是从他们的电子邮件中获取联系人(与 Netsuite 中的客户不同,虽然两者都是本机数据类型)的代码。对于客户来说,这将非常相似。

$service = new NetSuiteService();
$service->setSearchPreferences(false, 20);

$recordRef = new RecordRef();
$recordRef->internalId = '-6'; //Internal ID for a customer is -2, contact is -6

$contactSearch = new ContactSearch(); //use CustomerSearch() for a customer
$contactSearchBasic = new ContactSearchBasic();//SearchRecordBasic
$contactSearchBasic->email = new SearchStringField();
$contactSearchBasic->email->searchValue = 'someone@somewhere.com';
$contactSearchBasic->email->operator = SearchStringFieldOperator::is;
$contactSearch->basic = $contactSearchBasic;

$searchRequest = new searchRequest(); //% contains a searchRecord
$searchRequest->searchRecord = $contactSearch; 

$searchResponse = $service->search($searchRequest);
于 2015-02-07T03:23:34.730 回答
0

不久前,我在我的博客上发布了一些示例代码来做到这一点。我认为它应该回答你的问题:

看帖子

除其他外,我认为您会想要使用“CustomerSearchBasic”类型的 nsComplexObject。希望有帮助!

于 2012-06-15T12:54:07.073 回答