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
SachinKSachinK 

Getting Category Id for data categories

Do any one know how to fecth category Id for SFDC data categories.

 

Thanks,

Sachin

Vinita_SFDCVinita_SFDC

Hello,

 

For getting ID of the data category please use following query:

SELECT Id FROM CategoryData

 

Hope this helps!

Pratik MunotPratik Munot

I tried by the query but seem to be Salesforce doesn't expose the ids for datacategory.

Vinita_SFDCVinita_SFDC

Hello,

CategoryData is an object and DATA CATEGORY is syntax in a SOQL WITH clause. WITH DATA
CATEGORY is valid syntax, but WITH CategoryData is not supported.

A SOQL statement using a WITH DATA CATEGORY clause must also include a FROM ObjectTypeName clause where
ObjectTypeName equals:
• KnowledgeArticleVersion to query all article types
• an article type API Name to query a specific article type
• Question to query questions
When ObjectTypeName equals to KnowledgeArticleVersion or any article type API Name in the FROM clause, a WHERE
clause must be specified with one of the following parameters:
• PublishStatus to query articles depending on their status in the publishing cycle:
- WHERE PublishStatus='online' for published articles
- WHERE PublishStatus='archived' for archived articles
- WHERE PublishStatus='draft' for draft articles
• Id to query an article based on its id

 

Please refer the below link for detailed example at page 24:

http://www.salesforce.com/us/developer/docs/soql_sosl/salesforce_soql_sosl.pdf

 

Hope this helps!