How can I setup an integration between Salesforce CRM and Microsoft SQL Server using PHPToolKit? We dont want to use any ETL toolkit to integrate this two environments. We would like to pull the SQL data according to the business logic requests.
Currently, we can see that only data can be pushed to salesforce using this Toolkit. Does anyone have an idea, how rather we can pull the data on request from salesforce?


There are many samples in the official page.


You should be able to query

// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.com password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('../userAuth.php');
try {
  $mySforceConnection = new SforceEnterpriseClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

  $query = 'SELECT Id,Name from Account limit 5';
  $response = $mySforceConnection->query(($query));

  foreach ($response->records as $record) {

} catch (Exception $e) {
  echo $e->faultstring;
  • I want to Query Sql records and insert in Salesforce Jan 4 '17 at 9:31
  • You have to... user the upsert methods.
    – ransommule
    Jan 4 '17 at 13:49
  • Upsert means Insert or Update. First define field as external id in the SF object (commonly, you should save in this field the PK of the MS SQL table)
    – ransommule
    Jan 4 '17 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.