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
Ambili Vinay 17Ambili Vinay 17 

SOQL in Knowledge

Hi All,

in Salesforce Knowledge, i can see that we cannot query with PublishStatus IN ('Draft','Online') together and need to be queried seperately (2 SOQL everytime) for accomodating any logic.

Kindly let me know if you have faced this issue and is there any workaround?

Thanks in advance
 
SandhyaSandhya (Salesforce Developers) 
Hi,

Querying or searching articles in SOQL or SOSL requires that you specify either thePublishStatus or the Id field in the WHERE clause. You can search for only one publication status per article type in a single SOSL query. When searching for articles with a PublishStatus of Archived, also check that IsLatestVersionequals false in your WHERE clause.

Check below salesforce document.

https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledgearticleversion.htm
 
Best Regards,
Sandhya