2

Is it possible to override the knowledge auto suggest? Currently the knowledge auto suggests an article based on the case's subject. How can I modify and make it based on a custom field on Account. Thanks

1
  • Is that below answer solved your problem? If yes, please mark so that others can find it suitable. Commented Jul 7, 2016 at 18:11

1 Answer 1

3

You can use controller extension of ApexPages.KnowledgeArticleVersionStandardController as follows:

public class AgentContributionArticleController{
// The constructor must take a ApexPages.KnowledgeArticleVersionStandardController as an argument
public AgentContributionArticleController(ApexPages.KnowledgeArticleVersionStandardController ctl) 
{
    SObject article = ctl.getRecord(); //this is the SObject for the new article.
    //It can optionally be cast to the proper   article type, e.g. 
    //FAQ__kav article = (FAQ__kav) ctl.getRecord();  

    String sourceId = ctl.getSourceId(); //this returns the id of the case that was closed.     
    Account acct = [SELECT Custom_Field__c From Account WHERE Id IN (SELECT AccountId from Case where id=:sourceId)];       
    article.put('title', acct.Custom_Field__c);       
}
}

In the Knowledge settings, be sure to add this class for this settings: Use APEX customization under Case Settings

1
  • @gelay, Please mark the answer if it solves your problem Commented Jul 4, 2016 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .