• Web Development
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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]

I'm newbie and I would like to enrich my working lead-creator API with using assigment rules.

I found that I should precede the creating code with

 

$useDefaultRule = new soapval('useDefaultRule', null, 'true');
    $crmHandle->setHeader('AssignmentRuleHeader', array($useDefaultRule));

 

 

$useDefaultRule = new soapval('useDefaultRule', null, 'true');

$crmHandle->setHeader('AssignmentRuleHeader', array($useDefaultRule));

 

but it gives that setHeader() is an undefined method.

 

how could I fix the problem?

thanks for the answers