通过Netsuite中的自定义字段搜索客户 [英] Search Customer by custom field in Netsuite
问题描述
我能够使api在php中工作,并通过内部ID搜索客户. 但是我有一种情况,我将通过自定义字段搜索客户. 在客户"下,它具有一个自定义标签,其中包含多个域名和域详细信息.
I was able to make the api work in php and search customer by internal id. However i have a scenario, where i'll be searching a customer by a custom field. Under Customer and it has a custom tab contains multiple domain name and domain details.
例如:
主要搜索条件:域名
在netsuite php API中这怎么可能?非常感谢您的帮助.我只是NetSuite的新手. 我将如何修改此示例代码以按自定义字段进行搜索?
How is this possible in netsuite php api? Much appreciated for any help. im only newbie to NetSuite. How will i modify this sample code to search by custom field?
$service = new NetSuiteService();
$request = new GetRequest();
$request->baseRef = new RecordRef();
$request->baseRef->internalId = "1780";
$request->baseRef->type = "customer";
$getResponse = $service->get($request);
if (!$getResponse->readResponse->status->isSuccess) {
echo "GET ERROR";
} else {
$customer = $getResponse->readResponse->record;
//var_dump($customer);
echo "GET SUCCESS, customer:";
echo "\nCompany name: ". $customer->companyName;
echo "\nInternal Id: ". $customer->internalId;
echo "\nEmail: ". $customer->email;
echo "\nCustomerID: ". $customer->firstName;
}
好的,我正在尝试从egrubaugh360获取所有域的自定义记录.
OK, I'm trying to get the custom record of all domains base from egrubaugh360.
$service = new NetSuiteService();
$request = new GetRequest();
$request->baseRef = new CustomRecordRef();
$request->baseRef->internalId = "47";
//$request->baseRef->externalId = "xxxx";
$request->baseRef->typeId = "custom_list_domains";
$getResponse = $service->get($request);
var_dump($getResponse);
if (!$getResponse->readResponse->status->isSuccess) {
echo "GET ERROR";
} else {
var_dump($getResponse->readResponse->record);
echo "GET SUCCESS";
}
我不确定要在"typeId"中输入什么,究竟要输入什么类型?它给我错误无效的自定义记录类型密钥"
I'm not sure what to put in "typeId", what exactly is the type to put? It gives me error "Invalid custom record type key"
object(GetResponse)#8 (1) { ["readResponse"]=> object(ReadResponse)#9 (2) { ["status"]=> object(Status)#10 (2) { ["statusDetail"]=> array(1) { [0]=> object(StatusDetail)#11 (3) { ["code"]=> string(26) "INVALID_CSTM_RCRD_TYPE_KEY" ["message"]=> string(31) "Invalid custom record type key." ["type"]=> string(5) "ERROR" } } ["isSuccess"]=> bool(false) } ["record"]=> NULL } }
推荐答案
以下是通过自定义字段搜索客户的一般示例.
Here is a general example of searching for a customer by a custom field.
您可以根据自己的需要进行修改.
You can modify to fit your need.
$NSservice = new NetSuiteService();
$NSservice->setSearchPreferences(false, 10);
$cs = new CustomerSearch();
$csb = new CustomerSearchBasic();
$domain = new SearchCustomStringField();
$domain->internalId = 'yourcustomfieldinternalid';
$domain->searchValue = 'text you are searching for';
$domain->operator = 'is';
$scfl = new SearchCustomFieldList();
$scfl->customField = array($domain);
$csb->customFieldList = $scfl;
$cs->basic = $csb;
$request = new SearchRequest();
$request->searchRecord = $cs;
$searchResponse = $NSservice->search($request);
这篇关于通过Netsuite中的自定义字段搜索客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!