function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ChemburChembur 

Knowledge Article custom article type

I have a custom atricle type : faq_kav which has field: attachement of datatype: file

 

I want to display the name, summary and attachment from the above custom article using a component

 

Follwoing is query in the component controller to get the data

Select c.Id,c.Attachment__Name__s, c.Attachment__Length__s, c.Attachment__ContentType__s,c.Attachment__Body__s,  c.summary__c From faq__kav c WHERE c.PublishStatus = 'Online' and c.IsVisibleInPkb = true   and c.Language ='English' 

I keep getting error

Implementation restriction: When querying or searching the faq__kav 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 donot know the Ids to query the object. Custom article type cannot be queried and displayed?

any ideas appreciated

 

Vinita_SFDCVinita_SFDC

Hello Chembur,

 

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".
 
For normal SOQL query, You cannot pass dynamic parameters in the "Language" field in where clause. If you want to make your query dynamic w.r.t language field , you need to use dynamic SOQL to make it happen.
 
Example query:  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.
 
 
There is also an idea about this implementation restriction on article type :