0

尝试使用 phptoolkit 获取客户信息这是我的代码:

function getCustomer(){
  $service = new NetSuiteService();

  $request = new GetRequest();
  $request->baseRef = new RecordRef();
  $request->baseRef->account_id = "252206";
  $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;
  }
}

并得到这样的错误。

致命错误:未捕获的 SoapFault 异常:[soapenv:Server.userException] 无法确定 phptoolkit/NSPHPClient.php:338 中的客户 compid 堆栈跟踪:#0 phptoolkit/NSPHPClient.php(338):SoapClient->__soapCall('get', Array, NULL, Array) #1 phptoolkit/NetSuiteService.php(145953): NSPHPClient->makeSoapCall('get', Object(GetRequest)) #2 netsuite.php(23): NetSuiteService->get(Object(GetRequest)) #3

4

2 回答 2

1

基于 netsuite 文档 RecordRef只接受internalIdtype

$request->baseRef = new RecordRef();
$request->baseRef->internalId = "252206";
$request->baseRef->type = "customer";
于 2019-07-26T03:51:12.003 回答
0

您需要知道公司 ID 并将其放入您的设置文件中。还需要用户电子邮件地址、密码、角色内部 ID 和应用 ID。这些用于创建护照。

如果您的集成使用基于令牌的授权,则要求会有所不同。

查看工具包中的示例。

于 2018-03-14T09:57:45.223 回答