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
Web DevelopmentWeb Development 

Set Headers PHP Toolkit

I made a fix on the SforceBaseClient.php to allow for multiple headers.
Here is the Patch :
50a51
>     protected $assignmentRuleHeaders;
240a242,248
>
>             $headers = $this->assignmentRuleHeaders;
>
>             if ($headers != NULL) {
>                 $header_array = array_merge($header_array, $headers);
>             }
>
340a349,371
>     public function addAssignmentRuleHeader($header) {
>         if ($header != NULL) {
>
>             if (!isset($this->assignmentRuleHeaders)) {
>                 $this->assignmentRuleHeaders = array();
>             }
>
>             $header_values = array();
>
>             if (isset($header->assignmentRuleId)) {
>                 $header_values['assignmentRuleId'] =  $header->assignmentRuleId;
>             }
>
>             if (isset($header->useDefaultRuleFlag)) {
>                 $header_values['useDefaultRule'] =  $header->useDefaultRuleFlag;
>             }
>
>             $this->assignmentRuleHeaders[] = new SoapHeader($this->namespace, 'AssignmentRuleHeader', $header_values);
>         } else {
>             $this->assignmentRuleHeaders = NULL;
>         }
>     }
>
Then you can use something like the following :
foreach($rules as $rule) {
      $ruleHeader = new stdClass();
      $ruleHeader->assignmentRuleId = $rule->id;
      $this->connection->addAssignmentRuleHeader($ruleHeader);
}
This is good for when you are dinamically reading WebForms

@ Luis A. Camilo [https://www.linkedin.com/pub/luis-camilo/13/b6b/688]
NehalNehal (Salesforce Developers) 
Hi,

Thank you for sharing this information on community boards. This would be helpful for everyone.