Implementation Restriction while querying Article Types
|Knowledge Article Number||000113362|
While querying articles from article types, you may see an error:
"Implementation restriction: When querying the article_1__kav 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".
This error is due to query restriction on the article types, you should add "Language" column and "Publishstatus" column in query. otherwise you will get this error.
"Language" column is added in API version 21, so this column is for version 21 and after. If you try to us this language column in version 20, you will get an error of "No column found".
article_1__kav art = [SELECT Title FROM article_1__kav where language='en_US' and title='Myname' and publishstatus='online' ];
Here article_1__kav is your article type.
For normal SOQL query, You cannot pass dynamic parameters (bind variables) in the "Language" field in where clause. If you want to dynamically filter the language field , you need to use dynamic SOQL to make it happen. For example:
String lang = 'en_US'; String status = 'online'; List<How_To__kav> articles = Database.query('Select Id, Title From How_To__kav Where Language = :lang And publishStatus = :status');
There is also an idea about this implementation restriction on article type :