【问题标题】:How To Create a case Or Incident In Microsoft Dynamics Online CRM using php-crm-toolkit如何使用 php-crm-toolkit 在 Microsoft Dynamics Online CRM 中创建案例或事件
【发布时间】:2019-07-04 19:45:03
【问题描述】:

我正在尝试创建它给我的案例

“致命错误:未捕获的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();

?>

【问题讨论】:

标签: php dynamics-crm crm dynamics-crm-online


【解决方案1】:

错误很明确,一定要提到事件的客户——父账号或者联系方式。检查下面的代码,它应该可以工作(不确定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

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

$customer = $client->entity( 'contact' );
$customer->ID = 'GUID HERE';
$incident-> customerid = $customer;

【讨论】:

  • 谢谢 Arun,请告诉我如何获得
  • @PHPMagentoDeveloper guid 是任何 CRM 记录的主键 - 基本上看起来像带有破折号的 32 位数字。 arunpotti.wordpress.com/2016/07/10/…
  • 我也收到以下错误通知:未定义的属性通过 __set() - 事件不支持属性:D:\wamp64\www\php_crm\test.php 中 D:\ 第 37 行的 customerid_contact wamp64\www\php_crm\vendor\alexacrm\php-crm-toolkit\src\Entity.php 在第 264 行"
  • @PHPMagentoDeveloper 真的很抱歉,我是从记忆中输入的.. 也不确定您使用的是 web api 还是 odata api。尝试使用 customerid
  • 感谢您的帮助,出现致命错误:未捕获的错误:找不到类 'EntityReference'
【解决方案2】:

最后我使用以下代码创建了案例:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-07
    • 1970-01-01
    • 2013-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多