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 Answer
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
-
@gelay, Please mark the answer if it solves your problem Commented Jul 4, 2016 at 17:22