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?

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

3 Answers 3

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
1
  • 2
    If you're not sure, it probably woud be more appropriate to comment no ? Commented Jun 12, 2015 at 9:34

You must log in to answer this question.

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