I need to retrieve the knowledgeArtcticleVersion and the knowledgeArticle objects. I only have a list of caseArticle to start. So I try somethinf like that:

List<CaseArticle> lCaseArt = [SELECT Id, KnowledgeArticleId FROM CaseArticle WHERE CaseId =: pCaseId];

    List<Id> sIdKnowledgeArt = new List<Id>();
    for(CaseArticle ca : lCaseArt){
 List<KnowledgeArticle> lKnowledgeArt = [SELECT Id
                                            FROM KnowledgeArticle 
                                            WHERE Id IN :sIdKnowledgeArt];

List<KnowledgeArticleVersion> lKnowledgeArtVersion = [SELECT Id
                                                FROM KnowledgeArticleVersion 
                                                WHERE KnowledgeArticleId IN :sIdKnowledgeArt];

Here when I compile I got this error, about the last query :

Implementation restriction: When querying or searching the KnowledgeArticleVersion object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition.

I don't see what I am doing wrong. But to be honest I don't really see how I can retrive the knowledgeArtcticleVersion and the knowledgeArticle objects and if I can do a nested query betwwen them (I try this too, but got an error, so I try to do 2 differents queries)

1 Answer 1


As your error message clearly mention and also stated in docs:

Querying or searching articles in SOQL or SOSL requires that you specify either the PublishStatus or the Id field in the WHERE clause.

So you need to add PublishStatus in your second query as well.


You must log in to answer this question.

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