function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jim AndersonJim Anderson 

Setting AssignmentRuleHeader in PHP toolkit

 Hi All,

I need to create a case from the api and I have that part working but I need to set the AssignmentRuleHeader to use the defaul rules and I cant find any samples.  I'm lot on where or how to set it in my code. I see the functions are there in php toolkit.

Any help would be great...been at it for a few hours.

Thanks!

 

    $mySforceConnection = new SforcePartnerClient();
    $mySforceConnection->createConnection(SF_WSDL);
    $loginResult = $mySforceConnection->login(SF_USER_NAME, SF_PASSWORD);

try {
 
        $createFields = array (
          'Subject' => 'This is a test Case',
        );
        $sObject1 = new SObject();
        $sObject1->fields = $createFields;
        $sObject1->type = 'Case';
        $createResult = $mySforceConnection->create(array (
          $sObject1
        ));


  echo "<br>Case: ".$createResult->id;

    } catch (Exception $e) {
      global $errors;
      $errors = $e->faultstring;
      echo $errors;
    }

natefriedmannatefriedman
Here is the snippet of how I did it:

         $s_object = new SObject();
         $s_object->fields = $create_fields;
         $s_object->type = 'Lead';
         $s_object->fieldsToNull = array("Company");
 

// the "null" is the assignmentRuleID  arguement and the "true" is useDefaultRule arguement
$header = new AssignmentRuleHeader(null, true); 
                

          $leadResult = $mySforceConnection->create(array($slead_object),$header, NULL);