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
avtopi786avtopi786 

Knowledge Management API

Hi,

 

Trying to display custom field "Description__c" that is part of "Article Type" object. I am not able to access that field from knowledge API.I get "Authorization Failed" error.

 

For clarity, the VF page is called from public force.com site. The code described below was extracted from SFDC app exchange - "Public Knowledge Site". The code works fine when standard field is referenced.

 

Here is sample code:

 

<apex:outputPanel layout="block">
    <ul>
        <knowledge:articleList articleVar="article"
            categories="products:phone"
            sortBy="mostViewed"
            pageSize="10"
        >
            <li><a href="{!URLFOR($Action.KnowledgeArticle.View, article.id)}">{!article.description}</a></li>
        </knowledge:articleList>
    </ul>
</apex:outputPanel>

 

Any clue ?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
francoisLfrancoisL

Hi,

 

With knowledge:articleList VF component, you cannot access custom field available on your article type. You can only display standard field as title, summary, url_name.

 

If you want to dislay custom field, you need:

 - Create article list using SOSL/SOQL querying on your article type object (eg: FAQ => FAQ_kav)

 - use articleList VF component but a second SOQL query to get the custom field.

 

Does that make sense?

All Answers

sravusravu

Hi,

 

When you go to the site and click on public access settings, check the field level security once. Visible checkbox must be selected. I came across this situation, and when I checked the settings, the custom fields were not made visible by default.

 

Hope this helps you.

francoisLfrancoisL

Hi,

 

With knowledge:articleList VF component, you cannot access custom field available on your article type. You can only display standard field as title, summary, url_name.

 

If you want to dislay custom field, you need:

 - Create article list using SOSL/SOQL querying on your article type object (eg: FAQ => FAQ_kav)

 - use articleList VF component but a second SOQL query to get the custom field.

 

Does that make sense?

This was selected as the best answer
avtopi786avtopi786
@francoisL : That make sense - in theory. Let me test that out.
Thanks !
sampleuser101sampleuser101

If I use knowledge:articelList tag on a page inside a public force.com site, I get blank list. Do I need to use any standard controller? Here is my component code:

 

<apex:component >
<style>
td{
vertical-align : top;
text-align: left;
}
</style>
<apex:pageBlock title="Article List" >
<apex:panelGrid width="100%">
<table width="99%">
<tr>
<th width="33%">Title</th>
<th width="33%">Article Type</th>
<th width="33%">Summary</th>
</tr>
</table>
<knowledge:articleList articleVar="article" hasMoreVar="false" sortBy="mostViewed" pageSize="10">
<table width="99%">
<tr>
<td width="33%">
<apex:outputLink target="_blank" value="{!URLFOR($Action.KnowledgeArticle.View,
article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink>
</td>
<td width="33%"><apex:outputText >{!article.articleTypeLabel}</apex:outputText></td>
<td width="33%"><apex:outputText >{!article.abstract}</apex:outputText></td>
</tr>
</table>
</knowledge:articleList>
</apex:panelGrid>
</apex:pageBlock>

</apex:component>
francoisLfrancoisL

In this configuration, the tag is only going to show most viewed article published in last 30 days. To bypass this, you will need to specify a category (it can be All) and in this case the 30 days condition will not be taken in consideration?