0

I'm trying to create a Knowledge base search component that will allow users to keyword search and filter on Data Categories they have access to.

Imagine the following structure:

Data Category: Geography
-All
--  North America
---    USA
---    Canada
--  Europe
---    Spain
---    France
---    England
.....

VF Code:

<knowledge:categoryList categoryVar="category" categoryGroup="Geography" rootCategory="All" level="-1">
         <option value="{!category.name}">{!category.label}</option>
</knowledge:categoryList>

If I have a profile and give them access to the Spain and Canada data categories, I would expect to see the following when rendered:

<option>Spain</option>
<option>Canada</option>

Instead I don't see anything at all. The only way I can get anything to render is if I give access to the top level group "All".

Is there any way to actually get a list of data categories the user has access to? Either in VF directly or using Apex?

1

The knowledge:categoryList tag loops through the data category provided as the argument for rootCategory. if the user does not have access to All, the execution control does not even step into this loop.

The workaround is to find out the list of top data categories visible to the user and for each of the available top data categories, call the knowledge:categoryList to populate the child tree.

Check the method DescribeDataCategoryGroupStructures in this article for ideas on how to fetch the list of top data categories visible to the user. Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.