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
thechadthechad 

Crazy Old Pear:SOAP Issues

Hello,

Unfortunately, I am using an old PEAR:SOAP install, and a salesforce soap client found on source forge about 2 years ago.  It works great still, and I have modified it use the new functionality in the new wsdl.

I am however, having one issue with a couple of the functions.  If we look at upsert specifically, I can update 1 record, but it wont let me update an array of records (it supposed to let me do 200).

Here is the code I am using that works for a single record

Code:
$upsert_tasks['type'] = 'Task';
$upsert_tasks['External_ID__c'] = $data['LEAD']['TASK'][$x]['TASK_ID'];        
$upsert_tasks['Subject'] = utf8_encode($data['LEAD']['TASK'][$x]['SUMMARY']);
$upsert_tasks['Description'] = utf8_encode($data['LEAD']['TASK'][$x]['DESCRIPTION']);
$upsert_tasks['ActivityDate'] = substr($data['LEAD']['TASK'][$x]['DUE'],0,10);
$upsert_tasks['Priority'] = ($data['LEAD']['TASK'][$x]['PRIORITY']>3 — 'High' : 'Normal');        
$upsert_tasks['Status'] = $data['LEAD']['TASK'][$x]['STATUS'];        
$upsert_tasks['WhoId'] = $master_overall_record->Id[0];
$upsert_tasks['OwnerId'] = $owner_info->records->Id[0];
$upsert_task_final = array("ExternalIdFieldName"=>'External_ID__c',"sObjects"=>$upsert_tasks);
$results_upsert_tasks = $client->upsert($upsert_task_final);

Here is the code that does not work :

Code:
for($x=0; $x<sizeof( $data['LEAD']['TASK']); $x++) {
 $upsert_tasks[$y]['type'] = 'Task';
 $upsert_tasks[$y]['External_ID__c'] = $data['LEAD']['TASK'][$x]['TASK_ID'];         
 $upsert_tasks[$y]['Subject'] = utf8_encode($data['LEAD']['TASK'][$x]['SUMMARY']);
 $upsert_tasks[$y]['Description'] = utf8_encode($data['LEAD']['TASK'][$x]['DESCRIPTION']);
 $upsert_tasks[$y]['ActivityDate'] = substr($data['LEAD']['TASK'][$x]['DUE'],0,10);
 $upsert_tasks[$y]['Priority'] = ($data['LEAD']['TASK'][$x]['PRIORITY']>3 — 'High' : 'Normal');         
 $upsert_tasks[$y]['Status'] = $data['LEAD']['TASK'][$x]['STATUS'];         
 $upsert_tasks[$y]['WhoId'] = $master_overall_record->Id[0];
 $upsert_tasks[$y++]['OwnerId'] = $owner_info->records->Id[0];
}
$upsert_task_final = array("ExternalIdFieldName"=>'External_ID__c',"sObjects"=>$upsert_tasks);
$results_upsert_tasks = $client->upsert($upsert_task_final);

 It errors and says that it cannot find the type of the sobject.. any ideas?

Thank you in advanced.