5

From the ListView Object documentation - link - there is a mention that:

IsSoqlCompatible
Description Whether the list view can be used with SOQL..

But, I found no reference in APEX SOQL Query Docs on how to use this. I'm hoping to run an SOQL with my custom filters, PLUS want to further filter my records by passing a ListView (and this field seems important enough to identify whether a List View is compatible to be used in SOQL or not).

So does anyone knows how to use it in SOQL?

3
  • I asked the Salesforce documentation team to take a look. I don't have a satisfying answer to give you right now, but here's hoping we find something.
    – sfdcfox
    May 3, 2020 at 23:18
  • I've always assumed, but can't back up, that that field dictates whether or not you can get the list view's underlying SOQL from its describe. I've never found one that doesn't have that available (though I haven't looked that hard).
    – David Reed
    May 3, 2020 at 23:47
  • 3
    @DavidReed I assumed that initially as well, but today's research before I gave up proved me wrong. The only thing I seemed to have found is that if isSoqlCompatible = false, you apparently cannot use it in SOSL, which appears to be because the object itself isn't supported in SOSL. But that seems silly to have at the List View level, so something else is going on?
    – sfdcfox
    May 4, 2020 at 0:22

1 Answer 1

3

I think it essentially dictates that whether or not the list view can be generated via an SOQL.

If you run this query in console

SELECT Id, NamespacePrefix, Name, DeveloperName, IsSoqlCompatible, SobjectType
FROM ListView
ORDER BY IsSoqlCompatible

You will see that couple of object have IsSoqlCompatible as false, objects like Apex classes, lightning bundles, Visual Flow, users.

For me, some of the list views in USER objects were showing as true and some as false. So I picked the one which said false and went through each field in display and filter condition. I noticed that if the list view contains a field which is from a separate table but has a one to one relationship with User is included, the IsSoqlCompatible parameter is false.

As soon as I remove those fields, the parameter becomes true. In the case of USER, the fields were Identity verification fields like User Verified Email/Phone.


Conclusion,

Salesforce has ability to create list view spanning multiple objects which are shown as to be a single object on the UI.

These list view cannot be generated via SOQL so the parameter IsSoqlCompatible is false for them.

You must log in to answer this question.

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