The AssignmentRuleHeaderconstructor takes two arguments:

assignmentRuleId (string) - ID of a specific assignment rule to run for the Case or Lead. Can be an inactive assignment rule. The ID can be retrieved by querying the AssignmentRule object. If specified, do not specify useDefaultRule. This element is ignored for accounts, because all territory assignment rules are applied.

useDefaultRuleFlag (boolean) - If true for a Case or Lead, uses the default (active) assignment rule for a Case or Lead. If specified, do not specify an assignmentRuleId. If true for an Account, all territory assignment rules are applied, and if false, no territory assignment rules are applied.


Sample Call

<?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 AssignmentRuleHeader('01Q300000005lDg', false);
  $mySforceConnection->setAssignmentRuleHeader($header);

  $createFields = array (
  'FirstName' => 'DELETE_ME',
  'LastName' => 'DELETE_ME',
  'Email' => 'deleteme@salesforce.com',
  'Company' => 'DELETE_ME Company',
  'LeadSource' => 'PHPUnit2',
  'City' => 'Tokyo',
  'Country' => 'Japan'
  );
  $sObject1 = new SObject();
  $sObject1->fields = $createFields;
  $sObject1->type = 'Lead';

  try {
    $createResponse = $mySforceConnection->create(array ($sObject1));
    print_r($createResponse);
  } catch (SoapFault $fault) {
    $this->fail($fault->faultstring);
  }
?>