I want to query deleted records in Salesforce and retrieve the LastModifiedDate of these records.

My query:

"Select LastModifiedDate FROM Custom_Table__c WHERE  customFields = '456_0_1' ALL ROWS"

But i'm getting this error:

java.io.IOException: [MalformedQueryFault [ApiQueryFault [ApiFault  exceptionCode='MALFORMED_QUERY'
 customFields = '456_0_1' ALL ROWS
ERROR at Row:1:Column:111
unexpected token: 'ALL ROWS'

What's wrong?

  • 1
    Did you try escaping '456_0_1' as \'456_0_1\'? Commented Feb 26, 2018 at 12:23

1 Answer 1


You are getting this error because ALL ROWS is only allowed with SOQL inside of APEX code, so this is not going to work.

But since you are using talend, this is done easily by executing the following query and checking the "Include deleted records" checkbox as shown below:

enter image description here

hope it helps.

  • Thanks a lot, this worked. I have to use the component's feature.
    – OiRc
    Commented Feb 26, 2018 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .