function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Francesco SciutoFrancesco Sciuto 

Filter on multiple ArticleType when querying KnowledgeArticleVersion

Hello,

I am trying to make a function on a controller that gives me back  all the latest knowledge articles excluding the 'PCS__kav'. However when I save the controller with the following query (kaIds is a Set of knowledge article's Ids): 

List<KnowledgeArticleVersion> kav = [SELECT Id, KnowledgeArticleId, lastPublishedDate, ArticleType, UrlName, IsVisibleInCsp, IsVisibleInPkb, IsVisibleInPrm
                                       FROM KnowledgeArticleVersion
                                       WHERE PublishStatus = 'Online'
                                       AND Language = 'en_US'
                                       AND ArticleType != 'PCS__kav'
                                       AND IsLatestVersion = true
                                       AND (IsVisibleInCsp = true
                                       OR IsVisibleInPkb = true
                                       OR IsVisibleInPrm = true)
                                       AND KnowledgeArticleId IN :kaIds LIMIT 10000];    


in the row with  AND ArticleType != 'PCS__kav' I  get the following error message:
Error: Compile Error: Implementation restriction: this type of filter is not allowed on the Type field.

I get the same error if I replace that line with:
  • AND (ArticleType = 'FAQ__kav' OR ArticleType = 'How_to__kav') or
  • AND ArticleType NOT IN ('PCS__kav')

but I do NOT get any error if I use:
  • AND ArticleType = 'FAQ__kav' 
  • AND ArticleType IN ('FAQ__kav', 'How_to__kav')
So what's going on here? It is a simple condition on a field, why the filter is restricted for multiple products and not for one?  Is it a bug?