1

I'm a bit confused about the way Knowledge Articles work. To try them out, I've created an Article type, added a single custom field and created a draft article with some dummy data. The goal is to retrieve this article using SOQL in Apex. I manage to query some standard fields by using something like this

SELECT Id,Title,UrlName,Summary,KnowledgeArticleId FROM KnowledgeArticleVersion WHERE Language ='en_US' AND PublishStatus ='Draft'

but when I try to query the custom field, I get an error saying this field doesn't exist. What is the correct way to go about this?

  • Add the query you're using for the custom fields to your post. – Davin Casey Jun 11 '15 at 15:18
  • It's the same one, it just has 'Content__c' added to the list of fields – Valyrion Jun 12 '15 at 7:22
3

After some digging in workbench, I found that the new article type I had created apparently functions as a queryable object itself, not as a recordtype like I had expected.

I have access to all its fields by changing the query to this:

SELECT Id,Title,UrlName,Summary,KnowledgeArticleId,Content__c FROM MyType__kav WHERE Language ='en_US' AND PublishStatus ='Draft'

Where MyType is the name of the type I created

1
SELECT Id,Title,UrlName,Summary,KnowledgeArticleId 
  FROM KnowledgeArticleVersion 
 WHERE Language ='en_US' AND PublishStatus ='Online'

PublishStatus ='Online' it will show you only published article which is visible to community or any other place.

-1

Try

KnowledgeArticle.Content__c
  • 2
    If you're not sure, it probably woud be more appropriate to comment no ? – Samuel De Rycke Jun 12 '15 at 9:34

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.