You need to sign in to do that
Don't have an account?
Bobbin
Help required for creating records via php toolkit 13.0
I will try this posting again (sorry, new to this): I have used the example provided by the php toolkit and customised it to fit my client's current implementation as below:
Code:
<— error_reporting(E_ALL); ini_set("soap.wsdl_cache_enabled", "0"); define("SOAP_CLIENT_BASEDIR", "soapclient"); include_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php'); include_once("constants.php"); try { $mySforceConnection = new SforceEnterpriseClient(); $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml'); $mylogin = $mySforceConnection->login(SF_USER, SF_PASS); $description = "Request for User Registration: \n\n" ."Company Name: \nTest Company\n\n" ."User Name: Ryan Cauchi-Mills\n\n" ."Email Address: ryan@intercityurgent.co.nz\n\n"; $sObject = array( 'Origin' => 'MoBiz', 'RecordTypeId' => '012200000004v5q', 'MoBiz_User_Last_Name__c' => 'Cauchi-Mills', 'MoBizUserName__c' => 'Ryan', 'Company_Name__c' => 'Test Company', 'MoBiz_User_Id__c' => 'useridformobiz', 'Type' => 'Mobiz', 'Subject' => 'MoBiz Registration Request', 'Description' => $description ); echo "**** Creating the following:\r\n"; $createResponse = $mySforceConnection->create($sObject,'Case'); $ids = array(); foreach ($createResponse as $createResult) { print_r($createResult); } } catch (Exception $e) { echo "Exception found:\r\n"; echo $mySforceConnection->getLastRequest(); echo print_r($e); } –>
The response I though is:
**** Creating the following:
Notice: Undefined property: stdClass::$result in /var/www/digiweb01/improved/include/soapclient/SforceBaseClient.php on line 399
Warning: Invalid argument supplied for foreach() in /var/www/digiweb01/improved/include/test.php on line 34
What have I done wrong??
1. Need to define $sobject as an SObject. Use:
$sObject = new SObject();
2. An SObject has an id, a type, and fields, which is the array you currently have as $sObject. So use:
$sObject.type = 'Case';
$sObject.fields = <the array you now have for $sObject>;
3. The create operation wants to operate on an array. So use:
$createResponse = $mySforceConnection->create(array($sObject));
Hope this helps.