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
Bulent703Bulent703 

Delete id limit reached error

Hi,

 

I'm trying to run a Java application that bulk deletes records from Salesforce. However, I get the following error:

 

[UnexpectedErrorFault [ApiFault  exceptionCode='EXCEEDED_ID_LIMIT' exceptionMessage='delete id limit reached: 200']]

 

Here is my code (simplified):

 

public static DeleteResult[] deleteFiles(PartnerConnection conn, String[] idsToDelete) throws Exception

{

try

{

return conn.delete(idsToDelete);

}

catch(ConnectionException e)

{

logger.debug("Exception occured: " + e.getLocalizedMessage(), e);

throw new Exception("Exception occured: " + e.getLocalizedMessage(), e);

}

}

 

where I pass 9000 IDs into the array. Which limit am I hitting and how can I change this limit?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
_Prasu__Prasu_

There is limit on the number of Id;s which can be passed to delete() call. 

 In version 7.0 and later, you can pass a maximum of 200 object IDs to the delete() call. In version 6.0 and earlier, the limit is 2,000.

 

you can find further details at Link.

 

Solution for this could be limiting the the delete call for 200 Ids by breaking those 9000 Ids in the batches of 200.