当我尝试通过我的PHP代码在netsuite中添加CustomerSalesTeam时。它给了我一个错误
致命错误:未捕获SoapFault异常:[soapenv:Server.userException] org.xml.sax.SAXException:salesTeam on {urn:relationships_2013_1.lists.webservices.netsuite.com} CustomerSalesTeamList的类型必须为{urn:relationships_2013_1。 lists.webservices.netsuite.com} C:\ wamp \ www \ ns \ PHPToolkit \ NSPHPClient.php中的CustomerSalesTeam:287堆栈跟踪:#0 C:\ wamp \ www \ ns \ PHPToolkit \ NSPHPClient.php(287):SoapClient - > __ soapCall(' add',Array,NULL,Array)#1 C:\ wamp \ www \ ns \ PHPToolkit \ NetSuiteService.php(118604):NSPHPClient-> makeSoapCall(' add',Object(AddRequest))#2 C:\ wamp \ www \ ns \ samples \ add_customer.php(38):NetSuiteService-> add(Object(AddRequest))#3 {main}抛出C:第287行\ wamp \ www \ ns \ PHPToolkit \ NSPHPClient.php
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;
}
答案 0 :(得分:0)
您应该添加了在Setup>中创建的销售团队的内部ID销售>销售团队而不是销售团队的成员。
我不擅长PHP,但我认为这样可行。
$cst=new CustomerSalesTeam();
$cst->salesTeamList->internalId= idofyoursalesteam;