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
shunshun 

Batch delete using 2.0 API does not return response for each element

Hi,

When I make a batch delete request to delete more than one entity instance, I don't receive the same number of results in the responses coming back.  I understand that the normal delete operation (non-batch) doesn't return anything on a successful deletion, but in the case of a batch delete, if the number of results doesn't exactly match the number of requested deletions, it's not possible to figure out which instances caused the errors.

Below is the request sent in (only the header & body are displayed with ids changed):

  <soap:Header>
  <tns:headerStruct id="id1">
  <session_id xsi:type="xsd:string">sessionidhiddensession_id>
  <version xsi:type="xsd:string">2.0version>
  tns:headerStruct>
  soap:Header>
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <q1:batch xmlns:q1="sfconnector:SalesforceConnector">
  <type xsi:type="xsd:string">accounttype>
  <operation xsi:type="xsd:string">deleteoperation>
  <arguments href="#id1" />
  q1:batch>
  <soapenc:Array soapenc:arrayType="xsd:anyType[2]" id="id1">
  <Item href="#id2" />
  <Item href="#id3" />
  soapenc:Array>
  <soapenc:Array soapenc:arrayType="tns:mapEntry[1]" id="id2">
  <tns:mapEntry xsi:type="tns:mapEntry">
  <key xsi:type="xsd:string">idkey>
  <value xsi:type="xsd:string">id1hiddenvalue>
  tns:mapEntry>
  soapenc:Array>
   <soapenc:Array soapenc:arrayType="tns:mapEntry[1]" id="id3">
   <tns:mapEntry xsi:type="tns:mapEntry">
  <key xsi:type="xsd:string">idkey>
  <value xsi:type="xsd:string">id2hiddenvalue>
  tns:mapEntry>
  soapenc:Array>
  soap:Body>
soap:Envelope>
 
And below is the body portion of the result:
 
<ns1:Body xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
  <sfdc:batchResponse xmlns:sfdc="sfconnector:SalesforceConnector">
  <return>
  <value xsi:type="tns:array" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <valueArray xsi:type="tns:array">
       <value xsi:type="xsd:int">1228value>
       <value xsi:type="xsd:string">entity is deletedvalue>
   valueArray>
 value>
return>
sfdc:batchResponse>
ns1:Body>
 
As you can see I receive a faultcode and faultstring, but since I don't have an empty valueArray either before or after the valueArray displayed, I can't tell whether the error pertains to trying to delete the first id or the second id.
 
How can I determine which ID was actually deleted from the response?  Am I missing something here?
 
Thanks,
Shun
IspitaIspita
A reverse query to verify counts can resolve issue faced by you.
But it will be tedious.
Thanks