在 Netsuite 中按自定义字段搜索客户 [英] Search Customer by custom field in Netsuite

查看:26
本文介绍了在 Netsuite 中按自定义字段搜索客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使 api 在 php 中工作并通过内部 ID 搜索客户.但是我有一个场景,我将通过自定义字段搜索客户.在 Customer 下,它有一个包含多个域名和域详细信息的自定义选项卡.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆