I have the following code:
List<KnowledgeArticleVersion> articles = [SELECT Title, UrlName, FirstPublishedDate, Summary, ArticleType, LastModifiedDate
FROM KnowledgeArticleVersion
WHERE isVisibleInApp=:isInternal AND isVisibleInCsp=:isCustomer AND isVisibleInPkb=:isPublic
AND IsVisibleInPrm=:isPartner AND PublishStatus='Online' AND Language=:selectedLanguage];
System.debug('articles = ' + articles);
and I certainly fetch error:
Error 4 Implementation restriction:
When querying the KnowledgeArticleVersion object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or Language = [language ISO code]. In addition Language is only permitted in a top-level AND condition.
But after replacing var selectedLanguage on 'en_US' soql works fine.
List<KnowledgeArticleVersion> articles = [SELECT Title, UrlName, FirstPublishedDate, Summary, ArticleType, LastModifiedDate
FROM KnowledgeArticleVersion
WHERE isVisibleInApp=:isInternal AND isVisibleInCsp=:isCustomer AND isVisibleInPkb=:isPublic
AND IsVisibleInPrm=:isPartner AND PublishStatus='Online' AND Language='en_US'];
System.debug('articles = ' + articles);
Really I can`t select articles with dynamic lang?