You need to sign in to do that
Don't have an account?
melhedges
Problem with Create using PHP 5
Hi There,
I finally downloaded the new PHP 5 toolkit, and am able to get everything to work, except creating a new lead. From what I can tell in test, the line which it is getting caught up in, is the $result line. Please see code below.
$mySforceConnection = new SforcePartnerClient();
$sforceSoapClient = $mySforceConnection->createConnection($wsdl);
$mySforceConnection->setSessionHeader($sessionId);
$mySforceConnection->setEndpoint($location);
$servertime = $mySforceConnection->getServerTimestamp();
$myUserInfo = $mySforceConnection->getUserInfo();
$sforceSoapClient = $mySforceConnection->createConnection($wsdl);
$mySforceConnection->setSessionHeader($sessionId);
$mySforceConnection->setEndpoint($location);
$servertime = $mySforceConnection->getServerTimestamp();
$myUserInfo = $mySforceConnection->getUserInfo();
$fieldstoinsert = array('FirstName'=>'mel','LastName'=>'hedge','Title'=>'me','Company'=>'bc','Email'=>'mel@bc.com','Phone'=>'222','State'=>'TX','Country'=>'USA','Industry'=>'Tech','Status'=>'Suspect','Region__c'=>'central','LeadSource'=>'web site','Contact_Source__c'=>'web site','OwnerId'=>'00G30000000lXXX');
$sObj = new sObject();
$sObj->fields = $fieldstoinsert;
$sObj->type = 'Lead';
$result = $mySforceConnection->create(array ($sObj));
$sObj = new sObject();
$sObj->fields = $fieldstoinsert;
$sObj->type = 'Lead';
$result = $mySforceConnection->create(array ($sObj));
In the meanwhile, use the following syntax:
Code:
Code:
Something like returns:
Code: Shouldn't it errors + success = 2 since I would have uploaded 2 records?
The way you would do this now is to pass the create method an array of SObjects like so:
Code: Changes in version 1.0.3:
=========================
* Updated Create method to handle multiple records.
* Set the default encoding to UTF-8
* renamed constructor methods to __constructor