3

I'm trying to integrate Salesforce in another system and it's required to filter these, but the client should be fully free to use any filters he wants. Using a listview and settings its filters, he's able to create a filtered list in his Salesforce account, which I'm able to download using executeListView(). However, using chunks isn't an option, because of a limitation of the offset (max. offset = 2000) and fetching all records at once isn't an option as well, because it exhausts the server's memory.

The only option I have left, is to be able to retrieve what filters have been set for a listview and to create a query based on these retrieved filters.

Does anyone know if this is possible and if so, please share how to fetch these filters?

Thank you in advance!

2

Using ListView describe you can get lots of information about your List Views.

You can have both the details about each filter condition, the ordering and displayed fields/columns, but also the complete, already built SOQL string, which comes in quite handy.

Aa an option, you could retrieve the SOQL string from a ListView Describe call, and from that take only the criteria (WHERE) part to be re-used in your code adding any additional criteria you want (using Dynamic SOQL).

In particular I think your use-case will require an additional criteria to chunk record selection as you need (more than 2k records and less than all of them at once).

| improve this answer | |
  • Another option I got to just now is readMetadata(). Among other things, it'll also return an array with field, operation and value. – kurt Dec 14 '15 at 13:58

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.