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
StephenDavidsonStephenDavidson 

Making 'enable suggested articles' return useable results

I have created a 'before insert' trigger for the case object.  I have turned on the 'enable suggested articles'.  I have modified the subject so that the stop words are removed, words with _ are double quoted, and all remaining terms are and'ed.  THe result for the article search is quite nice.  Rather than getting hundreds of irrelevant results, I get a set of results that are related to the subject entered by the customer.   So for example, when I create a case with this subject: 

 

I get a Probe distribution fails error: inst_execute failed: permission denied

 

and based on the work I do in the trigger, here is what appears in the search textbox:

 

Probe and distribution and fails and error: and "inst_execute"" and failed: and permission and denied

 

ANd I get only the article result set that I expect to see for these keywords.

 

The problem is, I can't leave the subject like that.  I have tried some other triggers to revert the subject to the original value, but no luck.  What I would really like is the ability to choose the field that would be used for the search so rather than using the search field for my manipulations, I would use an independent field and then use that field (through some magic) for the search, leaving the original subject alone.

 

Anyone have any ideas on how to accomplish this?

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
francoisLfrancoisL

I guess that the page need to use as standardController the case object to be displayed in the list

All Answers

AmitSahuAmitSahu

Why don't you create another field which will copy the exact same text from the subject field.

 

You can use workflow for that matter and the new field can be off from any pagelayouts and all ......so users will never have a sight of that secret field.

 

You can then modify the new field the way you want..

francoisLfrancoisL

Stephen, 

 

there is 2 blog posts that explain how to tune the keyword search without to have to tweak the case subject:

 

 

 

Have a look! 

StephenDavidsonStephenDavidson

Hi Francois:

I have implemented most of the suggested solution.  I have made a couple of comments to the article itself indicating a couple of problems I had.  One resolved, the other still causing me undue consternation.  :-)

 

I have created the class and two apex pages but when I go to override the standard New button for cases, I don't see my page in the visualforce page dropdown.  Any suggestions?

 

 

francoisLfrancoisL

I guess that the page need to use as standardController the case object to be displayed in the list

This was selected as the best answer
StephenDavidsonStephenDavidson

I actually tried that and it appears in the list.  Something else is causing a problem and so I will spend today trying to resolve.  Seems to fall into a loop when I click the new button and never returns.  Nothing in the log from my system.debug statements.  I will report back with more details and my modified code, which basically is just first step of trimming out irrelevant code from the sample.