1

I am retrieving attachments through jitter bit SOQL query, but my all records are not retrieving through in the bulk so I have set the limit of 1000 but when I have download next 1000 records how can I skip first 1000 records from the SOQL query, I have tried OFFSET but it is giving the result only 1 record . Can you please help in this.

SOQL Query:

SELECT Id, Body, BodyLength, ConnectionReceivedId, ConnectionSentId, ContentType, CreatedById, CreatedDate, Description, IsDeleted, IsPartnerShared, IsPrivate, LastModifiedById, LastModifiedDate, Name, OwnerId, ParentId, SystemModstamp FROM Attachment order by Id limit 1000
3

IDs are numbers actually, so you can use the last selected ID in the next query. I mean, If you make a query SELECT Id FROM Attachment ORDER BY Id LIMIT 2 and it returns something like {a00J000000BWNYk, a00J000000BWNYl}. You can take the last ID and use it to found the next two Attachments, SELECT Id FROM Attachment WHERE Id > 'a00J000000BWNYl' ORDER BY Id LIMIT 2.

Hope it works!

2

Try this:

SELECT Id, Body, BodyLength, ConnectionReceivedId, ConnectionSentId, ContentType, CreatedById, CreatedDate, Description, IsDeleted, IsPartnerShared, IsPrivate, LastModifiedById, LastModifiedDate, Name, OwnerId, ParentId, SystemModstamp FROM Attachment ORDER BY Id LIMIT 1000 OFFSET 1000

The result set for the preceding example would be a subset of the full result set, returning rows 1001 through 2000 of the full set.

check it out for more information

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm

  • I have already try this but when I am using the offset in this query it giving the result only one record – Dev bluCursor Feb 5 at 9:30
  • I tried this at my end and it is working perfectly – Aladin Banwal Feb 5 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.