I'm trying to get all articles which are published and online. In my user I turned on all permission set and so one to have access to Knowledge.

List<Knowledge__kav> myList= [SELECT Id, KnowledgeArticleId, PublishStatus, Language, Title, Summary, ArticleNumber, ArticleType, ArticleBody__c FROM Knowledge__kav WHERE PublishStatus='Online'];

Above is my query, but in log i got sth like this.

sObject type 'Knowledge__kav' is not supported.

Can somebody know how to get all object of this type in Apex class ?

  • 1
    Have you enabled Knowledge User checkbox in your user who executing this query – Reshma Jan 18 '19 at 15:53

Knowledge can be a bit confusing to query. I don't believe querying knowledge directly is supported. However, you can query the knowledge articles per article type. For instance, if your article type is called Offer, you can query it like:

FROM Offer__kav
WHERE PublishStatus='online'
  • N.B. see schema. There is no Knowledge SObject – cropredy Jan 18 '19 at 21:32
  • I think there is an Knowledge sObject, just no object, or if there is an object for it then we can't query it. Otherwise the the error message shouldn't be: sObject type 'Knowledge__kav' is not supported – Kasper Jan 18 '19 at 21:48
  • right, I was sloppy - I meant Object :-) – cropredy Jan 18 '19 at 22:09
  • Yeah but when i try assigne it to list (List<sObject> or List<Object> or List<Knowledge__kav>) it doesnt work. So how i should assigne my query to list of some types of object ? – artist Jan 21 '19 at 8:01

Ok, the problem was that i havn not permission set on this article type. So if someone in future will have same issue this is the fix.

  • This answer would be more likely to help future visitors if you edit its content to specify how you check/manipulate this permission. – Adrian Larson Jan 21 '19 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.