我正在为 Dynamics 365 https://github.com/AlexaCRM/php-crm-toolkit使用 Alexa-php-toolkit ,使用它我可以成功创建新联系人,但我无法在联系人中添加帐户名,当我试试我得到这个错误:
注意:无法在第263行的../vendor/alexacrm/php-crm-toolkit/src/Entity.php中设置联系人实体的属性accountid。
这是我的脚本。
<?php
//URL: https://github.com/AlexaCRM/php-crm-toolkit
/**
* Use init.php if you didn't install the package via Composer
*/
use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;
require_once '../vendor/autoload.php';
require_once '../vendor/alexacrm/php-crm-toolkit/init.php';
require_once 'config.php';
require_once 'includes/db.php';
$db = new DB();
$options = getAuth();
$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );
$accountId = 'a2536507-018d-e711-8115-c4346bac0a5f';
// create a new contact
$contact = $service->entity( 'contact' );
$contact->accountid = $accountId;
$contact->firstname = 'Test';
$contact->lastname = 'Contact12';
$contact->jobtitle = 'Business Analyst';
$contact->mobilephone = '1002345679';
$contact->fax = '9902345679';
$contact->emailaddress1 = 'john.doe1@example.com';
$contact->address1_line1 = '119 Cambridge';
$contact->address1_line2 = 'Apt 22';
$contact->address1_city = 'Houston';
$contact->address1_stateorprovince = 'TX';
$contact->address1_postalcode = '77009';
$contact->address1_country = 'US';
$contactId = $contact->create();
echo $contactId;
?>