I am trying to create a VisualForce page where I display our articles in a tree like structure.
There are only 2 levels in the tree, so like:
+Root
++Geography
++Politics
++Economy
There are about 10 categories of level 2.
I tried using the <knowledge:articleList>
for each level of the tree, but this tag can be used up to 4 times on a page.
Then, I tried extracting all articles in my controller:
SELECT Id, Title, KnowledgeArticleId FROM KnowledgeArticleVersion WHERE PublishStatus ...
And it works fine, the only thing that doesn't is the actual link to the article, I do:
<apex:repeat value="{!controllerArticles}" var="article">
<a href="{!URLFOR($Action.KnowledgeArticle.View, article.id)}">{!article.title}</a><br/>
</apex:repeat>
And when I go to the page it get the Unauthorized page. It's weird cause when I use the <knowledge:articleList>
with the {!URLFOR($Action.KnowledgeArticle.View, article.id)}
it works fine and I see the links correctly.
Does URLFOR($Action.KnowledgeArticle.View)
action work only inside the <knowledge:articleList>
? If so, how can I create a link to an article?
Thank you.
Attribution to: Alexandru Luchian
Possible Suggestion/Solution #1
Two things to check:
- Have the users in question been grated access to view articles by way of their user profiles?
- Does the page work without error when run as yourself? Often with portal/sites pages, you'll get the 'unauthorised' notification when there has been an error and you're redirected to the internal-only error details page
Attribution to: Matt Lacey
Possible Suggestion/Solution #2
I found how to display a link to the Article.
<apex:repeat value="{!controllerArticles}" var="article">
<a href="{!$Site.CurrentSiteUrl}articles/Article_Type/{!article.urlName}">{!article.title}</a><br/>
</apex:repeat>
Attribution to: Alexandru Luchian
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/837