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

Display list of cases related to article on service console left sidebar

We have a requirement to display the list of cases that are related to an article in a service console sidebar when viewing a case that has an article associated to it.  In other words, I have a current case I am working with and I associated an article to the current case in context.  It would be nice to see list of cases that are associated to the same article in context of current case in the left sidebar of the service console (case detail or case feed view).  Support indicated that this is not an OOB feature.  So I am trying to create a apex class and then create a VF page to display the list of cases on the left side bar of the console.  While creating the apex I am getting the folloiwng error .  Can some help provide feed back on what the isue might be?

  [Error] Error: Compile Error: Illegal assignment from List<CaseArticle> to Case at line 16 column 5

Here is the code

public class CaseArticleExtension {

    public final Case thisCase;

    public String CaseId {get;set;}
    public String KnowledgeArticleId {get;set;}

    public Case selectedCase {get;set;}

    public CaseArticleExtension(ApexPages.StandardController stdController) {
        this.thisCase = (Case)stdController.getRecord();
        selectedCase = new Case();
    public pagereference CaseArticle(){
    selectedCase = [SELECT CaseId FROM CaseArticle WHERE KnowledgeArticleId = :KnowledgeArticleId];
    return apexpages.currentpage();
VF Page:
<apex:page standardController="CaseArticle" extensions="CaseArticleExtension" >
    <apex:form >
        <span>Case Number:</span>
        <apex:inputText value="{!ArticleId}"/>
        <apex:commandButton value="Search" action="{!CaseArticle}"/>

I was able to get this working.

Here is the class and the VF page code

public class SimilarKBCasesExtension {

    public Case currentRecord{get; set;}
    public SimilarKBCasesExtension (ApexPages.StandardController controller)
        currentRecord = [SELECT Id, Expertise__c,Product__c,Reason FROM Case WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    public Case[] getSimilarCases()
     //   Case currentCase = currentRecord();
        return [SELECT CaseNumber, Status,Product__C,Expertise__C,Reason FROM Case WHERE 
            Product__c = :currentRecord.Product__c AND
            Expertise__c = :currentRecord.Expertise__c AND
            Reason = :currentRecord.Reason AND
            Id != :currentRecord.Id];
 <apex:page standardController="Case" extensions="SimilarKBCasesExtension">
    <apex:form >
       <apex:sectionHeader title="Similar Cases" subtitle="{!Case.CaseNumber}"/>
       <apex:pageBlock title="Similar Cases to {!Case.CaseNumber}">
        <apex:pageBlockTable value="{!similarCases}" var="case">
            <apex:column >
                <apex:outputLink value="{!URLFOR($Action.Case.View, case.Id)}">View</apex:outputLink>
            <apex:column headerValue="Case Number" value="{!Case.CaseNumber}"/>
            <apex:column headerValue="Product" value="{!Case.Product__c}"/>
            <apex:column headerValue="Expertise" value="{!Case.Expertise__c}"/>
            <apex:column headerValue="Reason" value="{!Case.Reason}"/>

User-added image