我正在尝试按客户名称或InternalID获取SO记录。在NetSuite响应对象中,我在entity
键中获取客户名称。
[entity] => RecordRef Object
(
[internalId] => 145498
[externalId] =>
[type] =>
[name] => nameNameName
)
现在我想按客户的InternalID过滤SO记录,即145498
。
在SQL中我想要的是,
select * from Transactions where entity.internalId = 145498;
我该怎么做?
请帮忙。提前谢谢。
答案 0 :(得分:1)
以下是使用PHP搜索客户的代码。您可以使用您的打算记录类型替换客户。
$service = new NetSuiteService();
$request = new GetRequest();
$request->baseRef = new RecordRef();
$request->baseRef->internalId = "21";
$request->baseRef->type = "customer";
$getResponse = $service->get($request);
if (!$getResponse->readResponse->status->isSuccess) {
echo "GET ERROR";
} else {
$customer = $getResponse->readResponse->record;
echo "GET SUCCESS, customer:";
echo "\nCompany name: ". $customer->companyName;
echo "\nInternal Id: ". $customer->internalId;
echo "\nEmail: ". $customer->email . "\n";
}
希望有所帮助!
答案 1 :(得分:0)
我无法帮助您使用PHP,但以下使用Axis 1.4访问SuiteTalk Web服务的Java片段可以满足您的要求。希望你能把它翻译成PHP:
TransactionSearchBasic txnSrch = new TransactionSearchBasic();
txnSrch.setRecordType(new SearchStringField(RecordType._salesOrder, SearchStringFieldOperator.is));
txnSrch.setEntity(
new SearchMultiSelectField(
new RecordRef[] {new RecordRef(null, "145498", null, null)},
SearchMultiSelectFieldOperator.anyOf
)
);