我正在尝试为我提供案例
“致命错误:未捕获的AlexaCRM \ CRMToolkit \ SoapFault:您应在D:\ wamp64 \ www \ php_crm \ vendor \ alexacrm \ php-crm-toolkit \ src \ Client.php中指定父联系人或帐户。 1159“
我的代码:
<?php
/**
* Use init.php if you didn't install the package via Composer
*/
require_once 'vendor/autoload.php';
use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;
$options = [
'serverUrl' => '**********************',
'username' => '****************',
'password' => '*************',
'authMode' => '***********************',
];
$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );
// create a new contact
$incident = $service->entity( 'incident' );
$incident->title = 'Test Created With Proxy';
$incident->description = 'This is a test incident';
$incidentId = $incident->create();
?>
答案 0 :(得分:1)
最后,我通过使用以下代码创建了案例:
<?php
/**
* Use init.php if you didn't install the package via Composer
*/
require_once 'vendor/autoload.php';
use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;
use AlexaCRM\CRMToolkit\Entity\EntityReference;
$options = [
'serverUrl' => '**************************',
'username' => '**********************',
'password' => '*****************',
'authMode' => 'OnlineFederation',
];
$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );
$contact = $service->entity( 'contact' );
$contact->firstname = 'John';
$contact->lastname = 'Doe';
$contact->emailaddress1 = 'john.doe@example.com';
$guid = $contact->create();
$incident = $service->entity('incident');
//echo '<pre>';print_r($incident);echo '</pre>';
$incident->title = 'Test Created With Proxy';
$incident->description = 'This is a test incident';
$incident->customerid = new EntityReference( 'contact', $guid );
//$incident->ID = $guid;//contactid responsiblecontactid primarycontactid
$incidentId = $incident->create();
?>
答案 1 :(得分:0)
错误非常清楚,您必须提及事件的客户-父帐户或联系人。检查以下代码,它应该可以工作(不确定php语法)。
$incident = $service->entity( 'incident' );
$incident->title = 'Test Created With Proxy';
$incident->description = 'This is a test incident';
$incident->customerid = new EntityReference( 'contact', 'GUID HERE' );
$incidentId = $incident->create();
在上面的链接中,添加了另一个用于查找字段分配的代码段:
$customer = $client->entity( 'contact' );
$customer->ID = 'GUID HERE';
$incident-> customerid = $customer;