You need to sign in to do that
Don't have an account?
Francesco 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:
but I do NOT get any error if I use:
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')