简体   繁体   English

如何通过PHP中的Soap Enterprise API在Salesforce中创建帐户?

[英]How to create an Account in Salesforce via Soap Enterprise API in PHP?

got a problem with the creation of Account in Salesfoce with the SOAP API using enterprise.wsdl 使用enterprise.wsdl使用SOAP API在Salesfoce中创建帐户时遇到问题

Using this code 使用此代码

$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection -> createConnection("soapclient/enterprise.wsdl.xml");
try {$mySforceConnection -> login(USERNAME, PASSWORD, SECURITY_TOKEN);}
  catch (Exception $e) {echo "Connection not possible<br>";}

  $record = new stdClass();
  $record-> Name = 'test der API';
  $record-> Website = 'www.test.de';
  $response = $mySforceConnection -> create($record,'Account');

Got the error message: 得到了错误信息:

Notice: Undefined property: stdClass::$result in xyz on line 499

Can someone help on this? 有人可以帮忙吗? Thanks 谢谢

Best Thomas 最佳托马斯

mySforceConnection->create() expects first argument to be array of records. mySforceConnection-> create()期望第一个参数为记录数组。 Change the line to the following fixes the issue for me and creates the record successfully: 将行更改为以下内容可为我解决此问题并成功创建记录:

$response = $mySforceConnection->create(array($record),'Account');

You might still get Notices but the functionality seems to work. 您可能仍然会收到通知,但是该功能似乎可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM