Customise Knowledge Search

amacqueen
Mega Guru

We like many others, I'm sure, have the ability to search the knowledge base from Incident. I was wondering if there was a way to restrict the results displayed based on business service. I have already added business service to the knowledge base form and I was hoping there would be a way using the dictionary entry attributes of the description field which we use as the basis for searching the knowledge base, we currently have this set to:-

 

no_truncate=true,knowledge_search=true,ts_weight=10

 

Our business service field name is u_business_service.

 

TIA

1 ACCEPTED SOLUTION

solutioningnow
Giga Guru

Hi,



I have successfully configured the solution in one of the demo instance. For achieving you need to update below things:



Update dictionary attributes - knowledge_custom=customKnowledgeSearch,knowledge_search=false



Add onLoad Client Script:



function onLoad() {


  return;


}




function customKnowledgeSearch() {


  var searchText = g_form.getValue('short_description');


  var elementName = 'u_business_service';


  var url = 'kb_find.do?sysparm_search=' + escape(searchText);


  url += "&sysparm_nameofstack=kbpop";


  url += "&sysparm_kb_search_table=incident"; //This example runs on the Incident table. Edit the table name as necessary


  url += "&sysparm_operator=IR_AND_OR_QUERY"; //Tries an 'AND' exact match query and uses an 'OR' query if no exact match


  //url += "&sysparm_operator=IR_OR_QUERY"; //Searches using an 'OR' query


  //url += "&sysparm_operator=IR_AND_QUERY"; //Searches using an 'AND' query


  popupOpenStandard(url, "kb2task");


}



Please try and let me know the outcome



Regards,


Solutioner


View solution in original post

8 REPLIES 8

Forgot I'd made changes in Dev and have now cloned live over Dev what field should I update the dictionary attributes for please?



Sure I got this working last week and have now gone blank 😞


amacqueen
Mega Guru

No worries I've got it now 🙂


sai1489
Kilo Explorer

Hello ,


                I have a requirement where in i need to show the knowledge articles both   retired and published articles based on the text given in short description of an incident. I have not been able to customize the code you've given to any good effect . Could you please help me out with this .


Regards,


Sai


davidian
Tera Contributor

What's the purpose of this variable, it doesn't seem to get used anywhere?

var elementName = 'u_business_service';

I'd also like to know how to hide or remove the "Attach to <table>" button that is shown in 'kbpop' popup, but only for this custom search i.e. I don't want to affect existing knowledge searches.