I'm using salesforce's PHP SOAP client (SforceBaseClient) to attempt to delete records. It's working fine for less than 200 at a time, and I remember reading that you are limited to 200 rows at a time.
So, in a flash of imagined brilliance, I created a loop to step through batches of 200 records. The first batch works fine. But when it loops and tries to delete the second batch, I get the "Illegal character 0x0" error.
Later, I realized that the delete()
method in the SF SOAP client does exactly the same thing:
/**
* Deletes one or more new individual objects to your organization's data.
*
* @param array $ids Array of fields
* @return DeleteResult
*/
public function delete($ids) {
$this->setHeaders("delete");
if(count($ids) > 200) {
$result = array();
$chunked_ids = array_chunk($ids, 200);
foreach($chunked_ids as $cids) {
$arg = new stdClass;
$arg->ids = $cids;
$result = array_merge($result, $this->sforce->delete($arg)->result);
}
} else {
$arg = new stdClass;
$arg->ids = $ids;
$result = $this->sforce->delete($arg)->result;
}
return $result;
}
This should make it far easier; all I should have to do is call this method and pass it the complete array of IDs that I want to delete. Right?
...Except it gives me the very same error after processing 200 records.
Has anybody run into this and have a solution?
Clarification -- This has nothing to do with record #201; if I call this method twice with only 1 record, it fails on the second call.