• Bobbin
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
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??


 
  • December 16, 2008
  • Like
  • 0
New to salesforce *blush*  My customer requires I provide a query/insert/update class to interface with salesforce data via their API, rather than their existing mix of API+Web-To-Case.
 
My first stop was to use a PHP sample to see how the pieces fit.  Please someone advise if they can see where I've gone wrong.  Also, is it correct to refer to custom fields as I have in my code example below the results?
 
Unfortunately I get the following result:
-----------------------------------------------------------
**** 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 50
**** Now for Delete:
Notice: Undefined property: stdClass::$result in /var/www/digiweb01/improved/include/soapclient/SforceBaseClient.php on line 481
**** Now for UnDelete: 440500D200000001phK!AQcAQIW1c7e_WBmJ43xOQ.GloMvrcZk5I_2apGPNEvF5Og9FhAFuCneyaDAoEK8QmaeDlCu2_unMey9i5PEFv4jBbrzMUVF0 MISSING_ARGUMENT: undelete called with a batch of 0 ids to undelete; must specify at least 1 id
-----------------------------------------------------------
Code:
-----------------------------------------------------------
<?
error_reporting(E_ALL);
ini_set("soap.wsdl_cache_enabled", "0");
define("SOAP_CLIENT_BASEDIR", "soapclient");
include_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.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 = new stdclass();
  $sObject->origin                    = 'MoBiz';
  $sObject->recordType                = '012200000004v5q';
  $sObject->MoBiz_User_Last_Name__c   = 'Cauchi-Mills';
  $sObject->MoBizUserName__c          = 'Ryan';
  $sObject->Company_Name__c           = 'Test Company';
  $sObject->MoBiz_User_Id__c          = 'useridformobiz';
  $sObject->type                      = 'MoBiz';
  $sObject->email                     = 'ryan@intercityurgent.co.nz';
  $sObject->subject                   = 'MoBiz Registration Request';
  $sObject->description               = $description;

  echo "**** Creating the following:\r\n";
  $createResponse = $mySforceConnection->create($sObject, 'Case');
  $ids = array();
  foreach ($createResponse as $createResult) {
    print_r($createResult);
    array_push($ids, $createResult->id);
  }
  echo "**** Now for Delete:\r\n";
  $deleteResult = $mySforceConnection->delete($ids);
  print_r($deleteResult);
  echo "**** Now for UnDelete:\r\n";
  $deleteResult = $mySforceConnection->undelete($ids);
  print_r($deleteResult);
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>
  • December 16, 2008
  • Like
  • 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??


 
  • December 16, 2008
  • Like
  • 0
New to salesforce *blush*  My customer requires I provide a query/insert/update class to interface with salesforce data via their API, rather than their existing mix of API+Web-To-Case.
 
My first stop was to use a PHP sample to see how the pieces fit.  Please someone advise if they can see where I've gone wrong.  Also, is it correct to refer to custom fields as I have in my code example below the results?
 
Unfortunately I get the following result:
-----------------------------------------------------------
**** 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 50
**** Now for Delete:
Notice: Undefined property: stdClass::$result in /var/www/digiweb01/improved/include/soapclient/SforceBaseClient.php on line 481
**** Now for UnDelete: 440500D200000001phK!AQcAQIW1c7e_WBmJ43xOQ.GloMvrcZk5I_2apGPNEvF5Og9FhAFuCneyaDAoEK8QmaeDlCu2_unMey9i5PEFv4jBbrzMUVF0 MISSING_ARGUMENT: undelete called with a batch of 0 ids to undelete; must specify at least 1 id
-----------------------------------------------------------
Code:
-----------------------------------------------------------
<?
error_reporting(E_ALL);
ini_set("soap.wsdl_cache_enabled", "0");
define("SOAP_CLIENT_BASEDIR", "soapclient");
include_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.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 = new stdclass();
  $sObject->origin                    = 'MoBiz';
  $sObject->recordType                = '012200000004v5q';
  $sObject->MoBiz_User_Last_Name__c   = 'Cauchi-Mills';
  $sObject->MoBizUserName__c          = 'Ryan';
  $sObject->Company_Name__c           = 'Test Company';
  $sObject->MoBiz_User_Id__c          = 'useridformobiz';
  $sObject->type                      = 'MoBiz';
  $sObject->email                     = 'ryan@intercityurgent.co.nz';
  $sObject->subject                   = 'MoBiz Registration Request';
  $sObject->description               = $description;

  echo "**** Creating the following:\r\n";
  $createResponse = $mySforceConnection->create($sObject, 'Case');
  $ids = array();
  foreach ($createResponse as $createResult) {
    print_r($createResult);
    array_push($ids, $createResult->id);
  }
  echo "**** Now for Delete:\r\n";
  $deleteResult = $mySforceConnection->delete($ids);
  print_r($deleteResult);
  echo "**** Now for UnDelete:\r\n";
  $deleteResult = $mySforceConnection->undelete($ids);
  print_r($deleteResult);
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>
  • December 16, 2008
  • Like
  • 0
I'm struggling translating the java format from the API doc to a Perl call.