Netsuite Phptoolkit Could not determine customer compid

1k Views Asked by At

Trying to get the customer information using phptoolkit Here's my code:

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;
  }
}

And getting error like this.

Fatal error: Uncaught SoapFault exception: [soapenv:Server.userException] Could not determine customer compid in phptoolkit/NSPHPClient.php:338 Stack trace: #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

2

There are 2 best solutions below

0
On BEST ANSWER

Base on the netsuite documentation RecordRef only accept internalId and type

$request->baseRef = new RecordRef();
$request->baseRef->internalId = "252206";
$request->baseRef->type = "customer";
0
On

You need to know the company ID and put it in your settings file. Also need user email address, password, role Internal ID and app ID. These are used to create a passport.

If your integration uses token based authorization, the requirements are different.

Look in the samples in the toolkit.