0

We're working on a data driven application at the moment and are attempting to return a list of Attachment Id's.

Right now our SOQL query is effectively:

SELECT Id FROM Attachment WHERE LastModifiedDate >= LAST_N_MONTHS:24 LIMIT 100000

But we're getting an

OPERATION_TOO_LARGE

error telling us our query has exceeded 100k results. Any idea how we can successfully limit a query of the Attachment endpoint?

We can obviously limit it to under 100k by limiting the date range but that feels pretty fragile - any recommendations gratefully received.

EDIT: Update to the question I've tried this but Salesforce simply times out on it - even when limited to 1.

SELECT Id FROM Attachment WHERE ParentID IN (SELECT Id FROM <SObject> WHERE LastModifiedDate >= LAST_N_MONTHS:24) LIMIT 100000
1
  • Hopefully, the doc i linked will help clarify the behavior you are experiencing =)
    – glls
    Oct 21, 2019 at 15:44

1 Answer 1

0

Turns out this code does actually work:

SELECT Id FROM Attachment WHERE ParentID IN (SELECT Id FROM <SObject> WHERE LastModifiedDate >= LAST_N_MONTHS:24) LIMIT 100000

For some reason Workbench occasionally breaks when you run it - but actually running it via CURL to the query endpoint or similar returns results as expected.

You must log in to answer this question.

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