如何使用php-crm-toolkit在Microsoft Dynamics Online CRM中创建案例或突发事件

问题描述 投票:0回答:2

我正试图创造它给我的案例

“致命错误:未捕获AlexaCRM \ CRMToolkit \ SoapFault:您应该在第1159行的D:\ wamp64 \ www \ php_crm \ vendor \ alexacrm \ php-crm-toolkit \ src \ Client.php中指定父联系人或帐户”

我的代码:

<?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();

?>
php dynamics-crm crm dynamics-crm-online
2个回答
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 = '[email protected]';
$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();
?>

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();

Reference

从上面的链接中,为查找字段分配添加另一个片段:

$customer = $client->entity( 'contact' );
$customer->ID = 'GUID HERE';
$incident-> customerid = $customer;
© www.soinside.com 2019 - 2024. All rights reserved.