добавление CustomerSalesTeam в customer в netsuite PHPToolkit

#oracle #magento #netsuite

#Oracle #magento #netsuite

Вопрос:

Когда я пытаюсь добавить CustomerSalesTeam в Customer в netsuite с помощью моего PHP-кода. это выдает ошибку

Фатальная ошибка: неперехваченное исключение SoapFault: [soapenv:Server.userException] org.xml.sax.SAXException: команда продаж включена {urn:relationships_2013_1.lists.webservices.netsuite.com }CustomerSalesTeamList должен иметь тип {urn:relationships_2013_1.lists.webservices.netsuite.com }Клиентская база в C:wampwwwnsPHPToolkitNSPHPClient.php:287 Трассировка стека: #0 C:wampwwwnsPHPToolkitNSPHPClient.php (287): SoapClient->__soapCall(‘добавить’, Массив, NULL, Массив) #1 C:wampwwwnsPHPToolkitNetSuiteService.php (118604): NSPHPClient->makeSoapCall(‘добавить’, Объект(AddRequest)) #2 C:wampwwwnssamplesadd_customer.php (38): NetSuiteService->добавить(объект (AddRequest)) #3 {main} добавлено C:wampwwwnsPHPToolkitNSPHPClient.php в строке 287

 And my Customer adding Code is :

    require_once '../PHPToolkit/NetSuiteService.php';

$service = new NetSuiteService();

$customer = new Customer();
$customer->lastName = "sale";
$customer->firstName = "rep";
$customer->companyName = "sale rep testing";
$customer->phone = "123456789";

$cst=new CustomerSalesTeam();
//$c=new CustomerSalesTeam();
//$em=new RecordRef();
//$em->internalId='1333083';
//$cst->employee=$em;
$cst->employee->internalId="1372";
$cst->salesRole->internalId="1";
$cst->isPrimary=true;
$cst->contribution=10.4;


$cstl=new CustomerSalesTeamList();
$cstl->replaceAll=true;
//$cstl->salesTeam[]=$cst;
$cstl->salesTeam =array($cst);
//$cstl->salesTeam=$cst;
$customer->salesTeamList=$cstl;

//$salesRep=new RecordRef();
//$salesRep->internalId='2792';
//$customer->salesRep=$salesRep;
$request = new AddRequest();
$request->record = $customer;

//$service->update($arg)
$addResponse = $service->add($request);

if (!$addResponse->writeResponse->status->isSuccess) {
    echo "ADD ERROR";
    print_r($addResponse->writeResponse);
} else {
    echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
  

Комментарии:

1. Я использую PHPToolkit.

Ответ №1:

вы должны были добавить внутренний идентификатор отдела продаж, который вы создали в разделе Настройка> Продажи> Отдел продаж, а не члена отдела продаж.

я не силен в PHP, но я предполагаю, что это сработает.

 $cst=new CustomerSalesTeam();
$cst->salesTeamList->internalId= idofyoursalesteam;
  

Комментарии:

1. Но «salesTeamList» не является свойством CustomerSalesTeam. это свойство CustomerSalesTeamList. как можно использовать с CustomerSalesTeam.

2. вы назначаете отдел продаж клиенту?

3. Да, я хочу назначить отдел продаж

Ответ №2:

Просто замените

 $cst=new CustomerSalesTeam();
  

с

 $cst=new CustomerSalesTeam_relationships();