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
Karthik SankarKarthik Sankar 

Display rating of a knowledge article

I am using <knowledge:articleList sortBy="mostViewed"> in my visualforce to retrieve all the knowledge articles in the most viewed order. Then I am passing this to a custom component to display all the knowledge articles in a customized format. Sample code as below:


<knowledge:articleList articleVar="a" sortBy="mostViewed">

<c:customComp con={!con} aid="" title="" summary="" urlName="" articleTypeName="" articleTypeLabel="" lastModifiedDate="" firstPublishedDate="" lastPublishedDate=""/>



In the knowledge:articleList tag, only standard fields like KnowledgeArticleId, summary, urlName, etc are accessible as above. My requirement is to display the average rating of each of the knowledge article along with their label and name.


But the average rating field is available in a different object - KnowledgeArticleVoteStat which has a reference to KnowledgeArticleId. How do I use the average rating of an article (which is in a separate object) to display inside the knowledge:articleList tag?





If you want to retrieve this information, you will need to run a SOQL query to retrieve the article score.