
The EmailHeader constructor takes three boolean arguments: triggerAutoResponseEmail, triggerOtherEmail, and triggerUserEmail.
triggerAutoResponseEmail - Indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. In the Salesforce user interface, this email can be automatically triggered by a number of events, for example resetting a user password.
triggerOtherEmail - Indicates whether to trigger email outside the organization (true) or not (false). In the Salesforce user interface, this email can be automatically triggered by creating, editing, or deleting a contact for a case.
triggerUserEmail - Indicates whether to trigger email that is sent to users in the organization (true) or not (false). In the Salesforce user interface, this email can be automatically triggered by a number of events; resetting a password, creating a new user, adding comments to a case, or creating or modifying a task.
<?php
// 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.ocm password
define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
try {
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
$header = new EmailHeader(true, false, false);
$mySforceConnection->setEmailHeader($header);
$createFields = array (
'FirstName' => 'Nick',
'LastName' => 'Tran',
'Email' => 'ntran@test.com',
'Company' => 'DELETE_ME Company',
'LeadSource' => 'PHPUnit',
'City' => 'Tokyo',
'Country' => 'Japan'
);
$sObject1 = new SObject();
$sObject1->fields = $createFields;
$sObject1->type = 'Lead';
$createResponse = $mySforceConnection->create(array ($sObject1));
print_r($createResponse);
} catch (SoapFault $fault) {
print_r($mySforceConnection->getLastRequest());
print_r($fault);
}
?>
stdClass Object
(
[id] => 00Q5000000K1sL1EAJ
[success] => 1
)