diff --git a/soapclient/SforceBaseClient.php b/soapclient/SforceBaseClient.php index 4a59196..ed2ced6 100644 --- a/soapclient/SforceBaseClient.php +++ b/soapclient/SforceBaseClient.php @@ -566,6 +566,22 @@ protected function _sendEmail($arg) { public function convertLead($leadConverts) { $this->setHeaders("convertLead"); $arg = new stdClass(); + foreach ($leadConverts as $k=>$lc) { + if (isset($lc->contactRecord) && !$lc->contactRecord instanceof SoapVar) { + $lc->contactRecord = new SoapVar($lc->contactRecord, SOAP_ENC_OBJECT, 'Contact', $this->namespace); + } + + if (isset($lc->opportunityRecord) && !$lc->opportunityRecord instanceof SoapVar) { + $lc->opportunityRecord = new SoapVar($lc->opportunityRecord, SOAP_ENC_OBJECT, 'Opportunity', $this->namespace); + } + + if (isset($lc->accountRecord) && !$lc->accountRecord instanceof SoapVar) { + $lc->accountRecord = new SoapVar($lc->accountRecord, SOAP_ENC_OBJECT, 'Account', $this->namespace); + } + + $leadConverts[$k] = $lc; + } + $arg->leadConverts = $leadConverts; return $this->sforce->convertLead($arg); }