我是使用salesforce api的新手.我已经下载了saleforce / PHP工具包,并且能够从我服务器上的webform成功创建联系人和帐户.
原文链接:https://www.f2er.com/php/134132.html要创建联系人,我正在执行以下操作:
$records[0] = new stdclass(); $records[0]->FirstName = $FirstName; $records[0]->LastName = $LastName; $records[0]->Email = $Email; $records[0]->Phone = $Phone; $records[0]->MailingStreet = $MailingStreet; $records[0]->MailingCity = $MailingCity; $records[0]->MailingState = $MailingState; $records[0]->MailingPostalCode = $MailingPostalCode; $records[0]->MailingCountry = $MailingCountry; $records[0]->LeadSource = $LeadSource; $create = $mySforceConnection->create($records,'Contact');
要创建帐户,我正在执行以下操作
$records[0] = new stdclass(); $records[0]->Name = $Name $create = $mySforceConnection->create($records,'Account');
任何人都可以给我一个简单的例子,说明如何将联系人与帐户相关联?
我在表单上有一个复选框,询问这是否是一个组织.如果用户选中此框,我想创建一个包含某些数据的组织帐户,并创建与某些数据的联系并将这两个数据相关联.
我并不是在寻找一个完整的工作实例,而是更多的只是让我指向正确的方向.
假设我有一个ID为001Z0000004XeWfIAK的帐户
我试过了
$records[0] = new stdclass(); $records[0]->FirstName = $FirstName; $records[0]->LastName = $LastName; $records[0]->Email = $Email; $records[0]->Phone = $Phone; $records[0]->MailingStreet = $MailingStreet; $records[0]->MailingCity = $MailingCity; $records[0]->MailingState = $MailingState; $records[0]->MailingPostalCode = $MailingPostalCode; $records[0]->MailingCountry = $MailingCountry; $records[0]->LeadSource = $LeadSource; $records[0]->AccountId = '001Z0000004XeWfIAK'; $create = $mySforceConnection->create($records,'Contact');
@ superfell
它返回这个:
Array ( [0] => stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => A Household Contact's account must be a household. [statusCode] => FIELD_CUSTOM_VALIDATION_EXCEPTION ) ) [id] => [success] => ) )
但我试图将联系人与orginization联系起来