+ Start a Discussion
JO_DevJO_Dev 

Invalid PublishStatus filter value. Valid values are 'Draft','Online' and 'Archived'

Why can't I use the 'In' operator for this query?
SELECT KnowledgeArticleId from KnowledgeArticleVersion WHERE PublishStatus in ('Draft','Online','Archived') AND Language = 'en_US' 

I get the following error:

Invalid PublishStatus filter value. Valid values are 'Draft','Online' and 'Archived'
Pankaj_GanwaniPankaj_Ganwani
Hi,

It seems this is default restriction imposed by salesforce. For more info, you can refer below mentioned link:

http://salesforce.stackexchange.com/questions/38416/dynamic-query-on-knowledgearticleversion

Following considerations should be taken while querying on knowledge articles:

Always filter on a single value of PublishStatus unless the query filters on one or more primary key IDs. To support security, only users with the “Manage Articles” permission see articles whose PublishStatus value isDraft.

Archived article versions are stored in the articletype_kav object. To query archived article versions, specify the article Id and set sLatestVersion='0'.

Always filter on a single value of Language. However, in SOQL, you can filter on more than one Language if there is a filter on Id or KnowledgeArticleId.